diff options
author | hogelog | 2009-05-11 16:14:34 +0000 |
---|---|---|
committer | hogelog | 2009-05-11 16:14:34 +0000 |
commit | cd3ec739fe5d360b22f7e8ec990c2817c25f7bea (patch) | |
tree | 8db1fae7be16461d5141a3652901886532f0c7ae /char-hints-mod2.js | |
parent | 155f1c8b95ffb546484ceda113ed9312f68addab (diff) | |
download | vimperator-plugins-cd3ec739fe5d360b22f7e8ec990c2817c25f7bea.tar.bz2 |
* fix hittimeout bug (thanks id:tekezo!)
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33247 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'char-hints-mod2.js')
-rw-r--r-- | char-hints-mod2.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/char-hints-mod2.js b/char-hints-mod2.js index ca030ee..880ca5f 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -65,7 +65,6 @@ let g:hintlabeling: let g:hintlabeling="a" == TODO == -- fix bug that hinttimeout don't run ]]></detail> </VimperatorPlugin>; @@ -168,8 +167,16 @@ let g:hintlabeling: break; } } //}}} + function clearOriginalTimeout() //{{{ + { + liberator.eval('if(activeTimeout) clearTimeout(activeTimeout);activeTimeout = null;', hintContext); + } //}}} function processHintInput(hintInput, hints) //{{{ { + if (timer) { + clearTimeout(timer); + timer = null; + } let start = getStartCount(hintchars.length, hints.length); let num = chars2num(hintInput)-start; if(num < 0) return; @@ -184,6 +191,7 @@ let g:hintlabeling: alt.liberatorString = num; charhints.original.onEvent(alt); } + clearOriginalTimeout(); statusline.updateInputBuffer(hintInput); let validHints = hints.filter(function(hint) isValidHint(hintInput, hint)); @@ -192,20 +200,11 @@ let g:hintlabeling: return true; } - if (timer) { - clearTimeout(timer); - timer = null; - } let timeout = options["hinttimeout"]; if (timeout > 0) { - // -100 to prevent the conflict with original timeout. timer = setTimeout(function () { - if (hints.activeTimeout) { - clearTimeout(hints.activeTimeout); - hints.activeTimeout = null; - } charhints.original.processHints(true); - }, timeout - 100); + }, timeout); } } //}}} @@ -245,6 +244,7 @@ let g:hintlabeling: charhints.onInput(event); } else { charhints.original.onEvent(event); + clearOriginalTimeout(); statusline.updateInputBuffer(hintInput); } }, //}}} |