[gnome-builder] source-view: fix compose key insertion near special literals like "



commit e87858a467578d59e7c219845c0aad46732387fd
Author: Christian Hergert <chergert redhat com>
Date:   Sun Nov 13 17:55:54 2016 -0800

    source-view: fix compose key insertion near special literals like "
    
    We were not filtering all keys, nor doing it early enough to really be
    effective. This moves the key filtering much earlier in the key-handling
    process.

 libide/sourceview/ide-source-view.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 03a35bf..9badff1 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -2370,6 +2370,16 @@ ide_source_view_key_press_event (GtkWidget   *widget,
     return TRUE;
 
   /*
+   * Allow the Input Method Context to potentially filter this keystroke.
+   * We have to do this after the IdeSourceViewMode has had a chance to
+   * intercept this as it might want to change states. Since calling
+   * filter_keypress will potentially call 'commit-text', we need to
+   * steal things.
+   */
+  if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (self), event))
+    return TRUE;
+
+  /*
    * Handle movement through the tab stops of the current snippet if needed.
    */
   if (NULL != (snippet = g_queue_peek_head (priv->snippets)))
@@ -2431,13 +2441,6 @@ ide_source_view_key_press_event (GtkWidget   *widget,
     }
 
   /*
-   * Allow the Input Method Context to potentially filter this keystroke.
-   */
-  if ((event->keyval == GDK_KEY_Return) || (event->keyval == GDK_KEY_KP_Enter))
-    if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (self), event))
-      return TRUE;
-
-  /*
    * If we are going to insert the same character as the next character in the
    * buffer, we may want to remove it first. This allows us to still trigger
    * the auto-indent engine (instead of just short-circuiting the key-press).


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