From 9b033a2ee7dc5cac8bdfdd0dc61c09194d7ff9ae Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 1 Mar 2013 17:18:22 +0100 Subject: [PATCH] Stop hinting if no element is found. --- src/hints.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hints.js b/src/hints.js index 23e47be..2f777f2 100644 --- a/src/hints.js +++ b/src/hints.js @@ -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; } -- 2.20.1