From: Daniel Carl Date: Wed, 12 Jun 2013 22:13:43 +0000 (+0200) Subject: Fixed leaving input mode on load commit (#33). X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=57711abd9fb230e722ac52df164aa79d4970cec9;p=vimb.git Fixed leaving input mode on load commit (#33). If a page was loaded and text was typed into the inputbox, the input mode was left on WEBKIT_LOAD_COMMITED. Now we keep in insert mode also if the page loads to allow to type in a command into inputbox. Moved modkey unset to keybind.c where the modkeys are set. --- diff --git a/src/keybind.c b/src/keybind.c index 515cb7c..b98e6d7 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -245,6 +245,7 @@ static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event) /* check for escape or modkeys or counts */ if (IS_ESCAPE_KEY(keyval, state)) { + vb.state.modkey = vb.state.count = 0; /* switch to normal mode and clear the input box */ vb_set_mode(VB_MODE_NORMAL, true); @@ -275,6 +276,9 @@ static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event) Keybind *keybind = (Keybind*)link->data; command_run(keybind->command, keybind->param); + vb.state.modkey = vb.state.count = 0; + vb_update_statusbar(); + return true; } diff --git a/src/main.c b/src/main.c index 4fc3921..fc84477 100644 --- a/src/main.c +++ b/src/main.c @@ -149,9 +149,6 @@ gboolean vb_load_uri(const Arg *arg) uri = g_strdup_printf("http://%s", path); } - /* change state to normal mode */ - vb_set_mode(VB_MODE_NORMAL, false); - if (arg->i == VB_TARGET_NEW) { guint i = 0; char *cmd[7], xid[64]; @@ -205,8 +202,6 @@ gboolean vb_set_clipboard(const Arg *arg) */ gboolean vb_set_mode(Mode mode, gboolean clean) { - vb.state.modkey = vb.state.count = 0; - /* process only if mode has changed */ if (vb.state.mode != mode) { /* leaf the old mode */ @@ -421,8 +416,12 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) run_user_script(frame); } - /* status bar is updated by vb_set_mode */ - vb_set_mode(VB_MODE_NORMAL , false); + if (vb.state.mode & VB_MODE_INSERT) { + /* status bar is updated by vb_set_mode */ + vb_set_mode(VB_MODE_NORMAL, false); + } else { + vb_update_statusbar(); + } vb_update_urlbar(uri); break;