aboutsummaryrefslogtreecommitdiffstats
path: root/migemized_find.js
diff options
context:
space:
mode:
authoranekos2008-09-21 12:30:42 +0000
committeranekos2008-09-21 12:30:42 +0000
commitd2ec2c1208b5d145859f816e824de415b0e1ba1b (patch)
tree597363dcd63117928f3bd2af04757e522daaea71 /migemized_find.js
parente54f0d0e6b2b1e1d4dcf01fba46e6b78dd9b1498 (diff)
downloadvimperator-plugins-d2ec2c1208b5d145859f816e824de415b0e1ba1b.tar.bz2
遅延によるバグを修正したような趣
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@19679 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'migemized_find.js')
-rw-r--r--migemized_find.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/migemized_find.js b/migemized_find.js
index c6e8e06..008afea 100644
--- a/migemized_find.js
+++ b/migemized_find.js
@@ -263,14 +263,17 @@
// 前のタイマーを削除するために保存しておく
let delayCallTimer = null;
+ let delayedFunc = null;
let migemized = {
find: function find (str, backwards) {
// 短時間に何回も検索をしないように遅延させる
- let f = function () MF.findFirst(str, backwards);
- if (delayCallTimer)
+ delayedFunc = function () MF.findFirst(str, backwards);
+ if (delayCallTimer) {
+ delayCallTimer = null;
clearTimeout(delayCallTimer);
- delayCallTimer = setTimeout(function () f(), 300);
+ }
+ delayCallTimer = setTimeout(function () delayedFunc(), 300);
},
findAgain: function findAgain (reverse) {
@@ -279,6 +282,11 @@
},
searchSubmitted: function searchSubmitted (command, forcedBackward) {
+ if (delayCallTimer) {
+ delayCallTimer = null;
+ clearTimeout(delayCallTimer);
+ delayedFunc();
+ }
if (!MF.submit())
liberator.echoerr('not found: ' + MF.currentSearchText);
},