From: Daniel Carl Date: Wed, 14 Aug 2013 06:50:13 +0000 (+0200) Subject: Allow to clear the inputbox on also if it's focused. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=b2ae1f73626bdd260b88c0cb60ba24a4e5c0fd55;p=vimb.git Allow to clear the inputbox on also if it's focused. --- diff --git a/src/command.c b/src/command.c index 0b6162e..cc70721 100644 --- a/src/command.c +++ b/src/command.c @@ -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 */ diff --git a/src/keybind.c b/src/keybind.c index 86b2a6a..15cec61 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -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; }