[gtksourceview] view: better override ::move-cursor and ::delete-from-cursor



commit 8c04a3efe2eece890593af133c62f8e6c645b36a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Feb 4 21:32:22 2015 +0100

    view: better override ::move-cursor and ::delete-from-cursor
    
    Do the same as is done in GtkTextView.

 gtksourceview/gtksourceview.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 3def363..25bc0ee 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -1860,6 +1860,13 @@ gtk_source_view_move_cursor (GtkTextView    *text_view,
                             gint            count,
                             gboolean        extend_selection)
 {
+       if (!gtk_text_view_get_cursor_visible (text_view))
+       {
+               goto chain_up;
+       }
+
+       gtk_text_view_reset_im_context (text_view);
+
        switch (step)
        {
                case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
@@ -1878,6 +1885,7 @@ gtk_source_view_move_cursor (GtkTextView    *text_view,
                        break;
        }
 
+chain_up:
        GTK_TEXT_VIEW_CLASS (gtk_source_view_parent_class)->move_cursor (text_view,
                                                                         step,
                                                                         count,
@@ -1902,6 +1910,8 @@ gtk_source_view_delete_from_cursor (GtkTextView   *text_view,
                return;
        }
 
+       gtk_text_view_reset_im_context (text_view);
+
        gtk_text_buffer_get_iter_at_mark (buffer,
                                          &insert,
                                          gtk_text_buffer_get_insert (buffer));


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