Don't clear focus if vimb is in input mode.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 11 Dec 2014 08:23:50 +0000 (09:23 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 11 Dec 2014 08:23:50 +0000 (09:23 +0100)
If strict-focus is enabled and the user started typing into form field right
before the page way fully loaded, the focus was cleared, so that vimb switched
back to normal mode and executed the pressed keys as normal mode commands.
No the focus is only cleared if strict-focus is enabled and vimb is not in
input mode.

src/dom.c

index d7bd80e..4b27577 100644 (file)
--- a/src/dom.c
+++ b/src/dom.c
@@ -36,14 +36,15 @@ void dom_check_auto_insert(WebKitWebView *view)
     HtmlElement *element;
     Document *doc = webkit_web_view_get_dom_document(view);
 
-    if (vb.config.strict_focus) {
-        /* if there is focus on an element right after page load - remove it
-         * if strict-focus is enabled */
-        dom_clear_focus(view);
-    } else {
+    if (!vb.config.strict_focus) {
         /* if active element is editable - switch vimb to input mode */
         active = get_active_element(doc);
         auto_insert(active);
+    } else if (vb.mode->id != 'i') {
+        /* If there is focus on an element right after page load - remove it
+         * if strict-focus is enabled - but don't do this in case the user
+         * started typing explicitely. */
+        dom_clear_focus(view);
     }
 
     /* add event listener to track focus events on the document */