From 19b457d0f3ca303cf685ba4e3f30a6d8d31f5c03 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 5 Dec 2014 10:28:15 +0100
Subject: [PATCH] Don't switch from command to input mode if page says so.

---
 src/dom.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/dom.c b/src/dom.c
index 561e3b8..d7bd80e 100644
--- a/src/dom.c
+++ b/src/dom.c
@@ -202,8 +202,11 @@ static gboolean element_is_visible(WebKitDOMDOMWindow* win, WebKitDOMElement* el
 
 static gboolean auto_insert(Element *element)
 {
-    /* don't change mode if we are in pass through mode */
-    if (vb.mode->id != 'p' && dom_is_editable(element)) {
+    /* Change only the mode if we are in normal mode - passthrough should not
+     * be disturbed by this and if the user iy typing into inputbox we don't
+     * want to remove the content and force a switch to input mode. And to
+     * switch to input mode when this is already active makes no sense. */
+    if (vb.mode->id == 'n' && dom_is_editable(element)) {
         mode_enter('i');
 
         return true;
-- 
2.20.1