Don't give key presses to hint mode if this is off.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 4 Dec 2014 22:33:05 +0000 (23:33 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 4 Dec 2014 22:46:55 +0000 (23:46 +0100)
If commands where typed into inputbox, there where javaScript errors written
in case a ';' was typed. The decision when the hinting mode is active was
wrong. Hinting is always started explicit so we can check the mode flag to
decide if the key can be handled by the hinting mode.

src/ex.c
src/hints.c

index 4858427..1290df2 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -247,8 +247,10 @@ VbResult ex_keypress(int key)
     VbResult res;
     const char *text;
 
-    /* delegate call to the submode */
-    if (RESULT_COMPLETE == hints_keypress(key)) {
+    /* delegate call to hint mode if this is active */
+    if (vb.mode->flags & FLAG_HINTING
+        && RESULT_COMPLETE == hints_keypress(key)) {
+
         return RESULT_COMPLETE;
     }
 
index 9dec4ad..2482522 100644 (file)
@@ -70,12 +70,6 @@ VbResult hints_keypress(int key)
 {
     JSValueRef arguments[1];
 
-    /* if we are not already in hint mode we expect to get a ; to start
-     * hinting */
-    if (!(vb.mode->flags & FLAG_HINTING) && key != ';') {
-        return RESULT_ERROR;
-    }
-
     if (key == KEY_CR) {
         hints_fire();