Skip to content

Commit e8d2d6d

Browse files
committed
Merge pull request #429 from Quicksaver/findagain-fix
Fix not remembering last searched for value after switching tabs
2 parents 7eaba76 + 0f2ff2f commit e8d2d6d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

common/content/finder.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var Finder = Module("finder", {
8787
pattern = pattern.replace(/\\(\\[cClL])/g, "$1");
8888

8989
findbar._findField.value = pattern;
90+
this._lastSearchPattern = pattern;
9091
},
9192

9293
/**
@@ -160,13 +161,15 @@ var Finder = Module("finder", {
160161
*
161162
* @param {boolean} reverse Whether to search forwards or backwards.
162163
* @default false
163-
* @see Bug537013 https://bugzilla.mozilla.org/show_bug.cgi?id=537013
164164
*/
165165
findAgain: function (reverse) {
166166
// Nothing to find?
167-
if (!this.findbarInitialized || !this.findbar._findField.value)
167+
if (!this._lastSearchPattern)
168168
return;
169169

170+
if (this._lastSearchPattern != this.findbar._findField.value)
171+
this._processUserPattern(this._searchPattern);
172+
170173
this.findbar.onFindAgainCommand(reverse);
171174
},
172175

@@ -220,23 +223,19 @@ var Finder = Module("finder", {
220223
this.find(pattern);
221224
}
222225

223-
this._lastSearchPattern = pattern;
224-
225226
// TODO: move to find() when reverse incremental searching is kludged in
226227
// need to find again for reverse searching
227228
if (this._backwards)
228229
this.findAgain(true);
229230

230231
if (options["hlsearch"])
231-
this.highlight(findbar._findField.value);
232+
this.highlight();
232233
},
233234

234235
/**
235236
* Highlights all occurances of <b>str</b> in the buffer.
236-
*
237-
* @param {string} str The string to highlight.
238237
*/
239-
highlight: function (str) {
238+
highlight: function () {
240239
let findbar = this.findbar;
241240

242241
let btn = findbar.getElement("highlight");

0 commit comments

Comments
 (0)