aboutsummaryrefslogtreecommitdiffstats
path: root/migemized_find.js
diff options
context:
space:
mode:
authoranekos2008-09-21 12:20:59 +0000
committeranekos2008-09-21 12:20:59 +0000
commite54f0d0e6b2b1e1d4dcf01fba46e6b78dd9b1498 (patch)
treec8eb36604cc61f18b214c6ca209c4b6e44644dc6 /migemized_find.js
parent0880257f8b73f6bc308542a80ed470295492c9fd (diff)
downloadvimperator-plugins-e54f0d0e6b2b1e1d4dcf01fba46e6b78dd9b1498.tar.bz2
見つからなかったときの表示がおかしかったりするのを修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@19678 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'migemized_find.js')
-rw-r--r--migemized_find.js30
1 files changed, 17 insertions, 13 deletions
diff --git a/migemized_find.js b/migemized_find.js
index dc3ba03..c6e8e06 100644
--- a/migemized_find.js
+++ b/migemized_find.js
@@ -52,8 +52,10 @@
lastSearchText: null,
lastSearchExpr: null,
- previousSearchText: null,
lastDirection: null,
+ currentSearchText: null,
+ currentSearchExpr: null,
+ lastResult: null,
get buffer function () liberator.buffer,
@@ -155,15 +157,16 @@
findFirst: function (str, backwards) {
this.lastDirection = backwards;
- this.lastSearchText = str;
- this.lastSearchExpr = str = this.searchTextToRegExpString(str);
+ let expr = this.searchTextToRegExpString(str);
+ this.currentSearchText = str;
+ this.currentSearchExpr = expr;
let result, frames = this.currentFrames;
if (backwards)
frames = frames.reverse();
for each (let frame in frames) {
- let ret = this.find(str, backwards, this.makeBodyRange(frame));
+ let ret = this.find(expr, backwards, this.makeBodyRange(frame));
if (ret) {
result = this.storage.lastResult = {
frame: frame,
@@ -174,9 +177,11 @@
}
this.removeHighlight();
- if (result)
+ if (result)
this.highlight(result, true);
+ this.lastResult = result;
+
return result;
},
@@ -234,11 +239,12 @@
},
submit: function () {
- this.previousSearchText = this.lastSearchText;
+ this.lastSearchText = this.currentSearchText;
+ this.lastSearchExpr = this.currentSearchExpr;
+ return this.lastResult;
},
cancel: function () {
- this.lastSearchText = MF.previousSearchText;
},
get currentFrames function () {
@@ -268,15 +274,13 @@
},
findAgain: function findAgain (reverse) {
- MF.findAgain(reverse);
- if (!MF.storage.lastResult)
- liberator.echoerr('not found: ' + MF.lastSearchText);
+ if (!MF.findAgain(reverse))
+ liberator.echoerr('not found: ' + MF.currentSearchText);
},
searchSubmitted: function searchSubmitted (command, forcedBackward) {
- MF.submit();
- if (!MF.storage.lastResult)
- liberator.echoerr('not found: ' + MF.lastSearchText);
+ if (!MF.submit())
+ liberator.echoerr('not found: ' + MF.currentSearchText);
},
searchCanceled: function searchCanceled () {