X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fpager.c;h=05cf4bf7ddc013af8b0c09d251f37169c381da76;hb=b026b1ac697815f2bd67e11a8718478dc1d3aed6;hp=c51dbd75e0c43574fd52d35a3a4af9125b0767b2;hpb=87b7d67ad1810f6207f58bd13f03c885a808f4e5;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/pager.c b/libchimara/pager.c index c51dbd7..05cf4bf 100644 --- a/libchimara/pager.c +++ b/libchimara/pager.c @@ -130,16 +130,26 @@ pager_on_expose(GtkTextView *textview, GdkEventExpose *event, winid_t win) /* Check whether paging should be done. This function is called after the * textview has finished validating text positions. */ -void pager_after_size_request(GtkTextView *textview, GtkRequisition - *requisition, winid_t win) { +void +pager_after_size_request(GtkTextView *textview, GtkRequisition *requisition, winid_t win) +{ /* Move the pager to the last visible character in the buffer */ - gint view_height, scroll_distance; move_pager_and_get_scroll_distance( - GTK_TEXT_VIEW(win->widget), &view_height, &scroll_distance, FALSE - ); + gint view_height, scroll_distance; + move_pager_and_get_scroll_distance(GTK_TEXT_VIEW(win->widget), &view_height, &scroll_distance, FALSE); if(view_height <= 1) /* Paging is unusable when window is too small */ return; + + /* If not in interactive mode, then just scroll to the bottom. */ + ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(GTK_WIDGET(textview), CHIMARA_TYPE_GLK)); + g_assert(glk); + if(!chimara_glk_get_interactive(glk)) { + GtkTextIter end; + gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(textview), &end); + gtk_text_view_scroll_to_iter(textview, &end, 0.0, TRUE, 0.0, 0.0); + return; + } /* Scroll past text already read by user. This is automatic scrolling, so disable the pager_ajustment_handler * first, that acts on the belief the scolling is performed by the user. */