[gnome-text-editor] page: use scroll_to_mark() for goto line



commit 24dba5820d0735c57582968f5f266ec08369079f
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 7 14:57:26 2021 -0700

    page: use scroll_to_mark() for goto line
    
    This should bring the destination mark within .25 of the middle of the
    widget. However, it doesn't actually seem to be doing that as it's always
    bringing it to exactly the .5 position.
    
    This used to work in GTK 3, so there is definitely something to investigate
    upstream in GTK 4.
    
    Related #168

 src/editor-page-actions.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/editor-page-actions.c b/src/editor-page-actions.c
index edc22fb..5428f53 100644
--- a/src/editor-page-actions.c
+++ b/src/editor-page-actions.c
@@ -163,8 +163,9 @@ editor_page_actions_goto_line (GtkWidget  *widget,
              g_unichar_isspace (gtk_text_iter_get_char (&iter)))
         gtk_text_iter_forward_char (&iter);
       gtk_text_buffer_select_range (GTK_TEXT_BUFFER (document), &iter, &iter);
-      gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (self->view),
-                                          gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (document)));
+      gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (self->view),
+                                    gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (document)),
+                                    0.25, TRUE, 1.0, 0.5);
     }
 
   gtk_revealer_set_reveal_child (self->goto_line_revealer, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]