Stop hinting if no element is found.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 1 Mar 2013 16:18:22 +0000 (17:18 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 1 Mar 2013 16:18:22 +0000 (17:18 +0100)
src/hints.js

index 23e47be..2f777f2 100644 (file)
@@ -121,11 +121,10 @@ VimpHints = function Hints(bg, bgf, fg, style) {
 
         _helper(topwin, 0, 0);
 
-        _focus(1);
-        if (hintCount == 1) {
-            /* just one hinted element - might as well follow it */
+        if (hintCount <= 1) {
             return this.fire(1);
         }
+        _focus(1);
     };
 
     /* set focus to next avaiable hint */
@@ -202,7 +201,7 @@ VimpHints = function Hints(bg, bgf, fg, style) {
         n = n ? n : curFocusNum;
         var result = "DONE:";
         var hint = _getHintByNumber(n);
-        if (typeof(hint.elem) == "undefined") {
+        if (!hint || typeof(hint.elem) == "undefined") {
             return result;
         }