After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675649 - [Patch] gtk-demo: Fix typo
[Patch] gtk-demo: Fix typo
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-05-08 01:37 UTC by Volker Sobek (weld)
Modified: 2013-04-14 13:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[Patch] gtk-demo: Fix typo (871 bytes, patch)
2012-05-08 01:37 UTC, Volker Sobek (weld)
none Details | Review

Description Volker Sobek (weld) 2012-05-08 01:37:00 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);
Comment 1 Matthias Clasen 2012-05-26 02:51:49 UTC
No, the mark actually has right gravity.
Comment 2 Volker Sobek (weld) 2012-05-27 21:08:18 UTC
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);
Comment 3 Volker Sobek (weld) 2012-05-27 22:12:55 UTC
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?