[anjuta] sourceview: bgo#680770 - Don't scroll undo position to center if line already visible



commit a8f1ac8d8d41da75d83dabefb84ab16ea8621bb3
Author: Johannes Schmid <jhs gnome org>
Date:   Tue Mar 26 19:35:24 2013 +0100

    sourceview: bgo#680770 - Don't scroll undo position to center if line already visible

 plugins/sourceview/anjuta-view.c |   27 ++++++---------------------
 plugins/sourceview/sourceview.c  |    4 ++--
 2 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/plugins/sourceview/anjuta-view.c b/plugins/sourceview/anjuta-view.c
index 8bc60f2..cdc14c1 100644
--- a/plugins/sourceview/anjuta-view.c
+++ b/plugins/sourceview/anjuta-view.c
@@ -95,12 +95,8 @@ scroll_to_cursor_real (AnjutaView *view)
        GtkTextBuffer* buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
        g_return_val_if_fail (buffer != NULL, FALSE);
 
-       gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view),
-                                     gtk_text_buffer_get_insert (buffer),
-                                     0.25,
-                                     FALSE,
-                                     0.0,
-                                     0.0);
+       gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (view),
+                                           gtk_text_buffer_get_insert (buffer));
        
        view->priv->scroll_idle = 0;
        return FALSE;
@@ -453,12 +449,8 @@ anjuta_view_cut_clipboard (AnjutaView *view)
                                       clipboard,
                                       TRUE);
        
-       gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view),
-                                     gtk_text_buffer_get_insert (buffer),
-                                     ANJUTA_VIEW_SCROLL_MARGIN,
-                                     FALSE,
-                                     0.0,
-                                     0.0);
+       gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (view),
+                                           gtk_text_buffer_get_insert (buffer));
 }
 
 void
@@ -476,8 +468,6 @@ anjuta_view_copy_clipboard (AnjutaView *view)
                                              GDK_SELECTION_CLIPBOARD);
 
        gtk_text_buffer_copy_clipboard (buffer, clipboard);
-
-       /* on copy do not scroll, we are already on screen */
 }
 
 void
@@ -494,18 +484,13 @@ anjuta_view_paste_clipboard (AnjutaView *view)
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view),
                                              GDK_SELECTION_CLIPBOARD);
 
-       /* FIXME: what is default editability of a buffer? */
        gtk_text_buffer_paste_clipboard (buffer,
                                         clipboard,
                                         NULL,
                                         TRUE);
 
-       gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view),
-                                     gtk_text_buffer_get_insert (buffer),
-                                     ANJUTA_VIEW_SCROLL_MARGIN,
-                                     FALSE,
-                                     0.0,
-                                     0.0);
+       gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (view),
+                                           gtk_text_buffer_get_insert (buffer));
 }
 
 void
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index a0f369d..bf1110e 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -1177,8 +1177,8 @@ static void ieditor_goto_position(IAnjutaEditor *editor, IAnjutaIterable* icell,
        Sourceview* sv = ANJUTA_SOURCEVIEW(editor);
        sourceview_cell_get_iter (cell, &iter);
        gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (sv->priv->document), &iter);
-       gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (sv->priv->view),
-                                                                 &iter, 0, FALSE, 0, 0);
+       gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (sv->priv->view),
+                                           gtk_text_buffer_get_insert (sv->priv->document));
 }
 
 /* Return a newly allocated pointer containing the whole text */


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