Observe input change events only in command mode.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 14 Aug 2013 11:44:52 +0000 (13:44 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 14 Aug 2013 11:44:52 +0000 (13:44 +0200)
src/hints.c
src/main.c

index ab22e2f..1a0cce0 100644 (file)
@@ -219,6 +219,7 @@ static void observe_input(gboolean observe)
     }
 }
 
+/* TODO move this event handler to a more generic place in vimb */
 static void changed_cb(GtkTextBuffer *buffer)
 {
     char *text;
index 4c86ff1..1d98781 100644 (file)
@@ -155,9 +155,12 @@ static void input_changed_cb(GtkTextBuffer *buffer)
     char *text;
     GtkTextIter start, end;
     gboolean forward;
-    if (!gtk_widget_is_focus(GTK_WIDGET(vb.gui.input))) {
-        /* if the widget isn't focused the change comes not from the user and
-         * we can skip further processing */
+
+    /* if vimb isn't in command mode, all changes are considered as output of
+     * some commands that we don't want here */
+    /* TODO find a better place to only observe the change events in command
+     * mode */
+    if (!(vb.state.mode & VB_MODE_COMMAND)) {
         return;
     }