GNOME Bugzilla – Bug 675649
[Patch] gtk-demo: Fix typo
Last modified: 2013-04-14 13:04:44 UTC
Created attachment 213630 [details] [review] [Patch] gtk-demo: Fix typo --- a/demos/gtk-demo/textscroll.c +++ b/demos/gtk-demo/textscroll.c @@ -86,7 +86,7 @@ scroll_to_bottom (GtkTextView *textview) gtk_text_iter_set_line_offset (&iter, 0); /* and place the mark at iter. the mark will stay there after we - * insert some text at the end because it has right gravity. + * insert some text at the end because it has left gravity. */ mark = gtk_text_buffer_get_mark (buffer, "scroll"); gtk_text_buffer_move_mark (buffer, mark, &iter);
No, the mark actually has right gravity.
The mark used by scroll_to_end has right gravity, but the mark used by scroll_to_bottom has left gravity. In setup_scroll: /* If we want to scroll to the bottom, but not scroll horizontally, * then an end mark won't do the job. Just create a mark so we can * use it with gtk_text_view_scroll_mark_onscreen, we'll position it * explicitely when needed. Use left gravity so the mark stays where * we put it after inserting new text. */ gtk_text_buffer_create_mark (buffer, "scroll", &iter, TRUE);
What is confusing here is that for the purpose of this demo the gravity of the mark used by scroll_to_bottom doesn't matter as it is moved to the beginning of the last line after the new text has been inserted, or am I missing something?