aboutsummaryrefslogtreecommitdiffstats
path: root/char-hints-mod2.js
diff options
context:
space:
mode:
authorhogelog2009-05-11 16:14:34 +0000
committerhogelog2009-05-11 16:14:34 +0000
commitcd3ec739fe5d360b22f7e8ec990c2817c25f7bea (patch)
tree8db1fae7be16461d5141a3652901886532f0c7ae /char-hints-mod2.js
parent155f1c8b95ffb546484ceda113ed9312f68addab (diff)
downloadvimperator-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.js22
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);
}
}, //}}}