From 061710981ba7a9fde2d09d1764f760e8ac322254 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Thu, 11 Dec 2014 09:23:50 +0100 Subject: [PATCH] Don't clear focus if vimb is in input mode. 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dom.c b/src/dom.c index d7bd80e..4b27577 100644 --- 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 */ -- 2.20.1