From 2b7431543a7709b598be6c7820214d61bb47fa81 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Wed, 14 Aug 2013 13:44:52 +0200 Subject: [PATCH] Observe input change events only in command mode. --- src/hints.c | 1 + src/main.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) 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; } -- 2.20.1