From: Daniel Carl <danielcarl@gmx.de>
Date: Wed, 14 Aug 2013 11:44:52 +0000 (+0200)
Subject: Observe input change events only in command mode.
X-Git-Url: https://git.owens.tech/assets/editable-focus.html/assets/editable-focus.html/git?a=commitdiff_plain;h=2b7431543a7709b598be6c7820214d61bb47fa81;p=vimb.git

Observe input change events only in command mode.
---

diff --git a/src/hints.c b/src/hints.c
index ab22e2f..1a0cce0 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -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;
diff --git a/src/main.c b/src/main.c
index 4c86ff1..1d98781 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
     }