Removed function from public scope.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 20 Jul 2015 10:54:26 +0000 (12:54 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 20 Jul 2015 10:54:26 +0000 (12:54 +0200)
The function dom_auto_insert_unless_strict_focus was only used internal and
was really small, so the content was moved to the only placed where it was
called.
Also added a missed comment that might still be interesting.

src/dom.c
src/dom.h

index 7fc24bb..3e86e81 100644 (file)
--- a/src/dom.c
+++ b/src/dom.c
@@ -30,19 +30,6 @@ static gboolean editable_focus_cb(Element *element, Event *event);
 static Element *get_active_element(Document *doc);
 
 
-void dom_auto_insert_unless_strict_focus(Document *doc)
-{
-    Element *active = webkit_dom_html_document_get_active_element(WEBKIT_DOM_HTML_DOCUMENT(doc));
-
-    if (active) {
-        if (!vb.config.strict_focus) {
-            auto_insert(active);
-        } else if (vb.mode->id != 'i') {
-            webkit_dom_element_blur(active);
-        }
-    }
-}
-
 void dom_install_focus_blur_callbacks(Document *doc)
 {
     HtmlElement *element = webkit_dom_document_get_body(doc);
@@ -62,7 +49,20 @@ void dom_install_focus_blur_callbacks(Document *doc)
 
 void dom_check_auto_insert(Document *doc)
 {
-    dom_auto_insert_unless_strict_focus(doc);
+    Element *active = webkit_dom_html_document_get_active_element(WEBKIT_DOM_HTML_DOCUMENT(doc));
+
+    if (active) {
+        if (!vb.config.strict_focus) {
+            auto_insert(active);
+        } else if (vb.mode->id != 'i') {
+            /* If strict-focus is enabled and the editable element becomes
+             * focus, we explicitely remove the focus. But only if vimb isn't
+             * in input mode at the time. This prevents from leaving input
+             * mode that was started by user interaction like click to
+             * editable element, or the 'gi' normal mode command. */
+            webkit_dom_element_blur(active);
+        }
+    }
     dom_install_focus_blur_callbacks(doc);
 }
 
index db3331a..892a2d8 100644 (file)
--- a/src/dom.h
+++ b/src/dom.h
@@ -33,7 +33,6 @@
 #define HtmlTextareaElement WebKitDOMHTMLTextAreaElement
 
 void dom_install_focus_blur_callbacks(Document *doc);
-void dom_auto_insert_unless_strict_focus(Document *doc);
 void dom_check_auto_insert(Document *doc);
 void dom_clear_focus(WebKitWebView *view);
 gboolean dom_focus_input(Document *doc);