From: Daniel Carl Date: Thu, 11 Dec 2014 08:23:50 +0000 (+0100) Subject: Don't clear focus if vimb is in input mode. X-Git-Url: https://git.owens.tech/editable-focus.html/editable-focus.html/git?a=commitdiff_plain;h=061710981ba7a9fde2d09d1764f760e8ac322254;p=vimb.git 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. --- 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 */