+ return endpos.y - pagerpos.y;
+}
+
+static void
+start_paging(GtkTextView *textview)
+{
+ currently_paging = TRUE;
+ g_signal_handler_unblock(textview, expose_handler);
+ g_signal_handler_unblock(textview, pager_handler);
+}
+
+static void
+stop_paging(GtkTextView *textview)
+{
+ currently_paging = FALSE;
+ g_signal_handler_block(textview, expose_handler);
+ g_signal_handler_block(textview, pager_handler);
+}
+
+static void
+after_insert(GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, GtkTextView *textview)
+{
+ while(gtk_events_pending())
+ gtk_main_iteration();
+
+ /* Move the pager to the last visible character in the buffer */
+ gint scroll_distance = move_pager_and_get_scroll_distance(textview);
+