Allow to clear the inputbox on <esc> also if it's focused.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 14 Aug 2013 06:50:13 +0000 (08:50 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 14 Aug 2013 07:03:50 +0000 (09:03 +0200)
src/command.c
src/keybind.c

index 0b6162e..cc70721 100644 (file)
@@ -536,6 +536,8 @@ gboolean command_yank(const Arg *arg)
             text = gtk_clipboard_wait_for_text(SECONDARY_CLIPBOARD());
         }
         if (text) {
+            /* TODO should we show the full ynaked content with
+             * vb_set_input_text, wich migh get very large? */
             vb_echo_force(VB_MSG_NORMAL, false, "Yanked: %s", text);
             g_free(text);
 
@@ -544,7 +546,7 @@ gboolean command_yank(const Arg *arg)
 
         return false;
     }
-    /* use current arg.s a new clipboard content */
+    /* use current arg.s as new clipboard content */
     Arg a = {arg->i};
     if (arg->i & COMMAND_YANK_URI) {
         /* yank current url */
index 86b2a6a..15cec61 100644 (file)
@@ -249,11 +249,18 @@ static gboolean keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer is_i
     /* check for escape or modkeys or counts */
     if (IS_ESCAPE_KEY(keyval, state)) {
         vb.state.modkey = vb.state.count = 0;
+
+        /* remove focus from possible focused inputbox - this allows to clear
+         * the inputbox also if esc is pressed from inputbox for example after
+         * yanking some text or the result of the :shecllcmd */
+        gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
+
         /* switch to normal mode and clear the command line */
         vb_set_mode(VB_MODE_NORMAL, true);
 
         return true;
     } else if (GPOINTER_TO_INT(is_input) && keyval == GDK_Return) {
+        /* simulate the gtk entries activate callback */
         vb_input_activate();
         return true;
     }