Bug 767401 - Clearing the searched token in the scripts filter should also clear the 'find next' history; r=past

This commit is contained in:
Victor Porof 2012-07-15 10:12:06 +03:00
parent 723701162a
commit d10808c6ce
2 changed files with 22 additions and 1 deletions

View File

@ -461,7 +461,7 @@ ScriptsView.prototype = {
if (line > -1) {
editor.setCaretPosition(line - 1);
}
if (token) {
if (token.length) {
let offset = editor.find(token, { ignoreCase: true });
if (offset > -1) {
editor.setSelection(offset, offset + token.length)
@ -480,6 +480,10 @@ ScriptsView.prototype = {
if (e.keyCode === e.DOM_VK_RETURN || e.keyCode === e.DOM_VK_ENTER) {
let token = this._getSearchboxInfo()[2];
if (!token.length) {
return;
}
let editor = DebuggerView.editor;
let offset = editor.findNext(true);
if (offset > -1) {

View File

@ -124,6 +124,23 @@ function testScriptSearching() {
token = "debugger";
write("#" + token);
ok(gEditor.getCaretPosition().line == 2 &&
gEditor.getCaretPosition().col == 44 + token.length,
"The editor didn't jump to the correct token. (12.1)");
clear();
EventUtils.sendKey("RETURN");
ok(gEditor.getCaretPosition().line == 2 &&
gEditor.getCaretPosition().col == 44 + token.length,
"The editor shouldn't jump to another token. (12.2)");
EventUtils.sendKey("ENTER");
ok(gEditor.getCaretPosition().line == 2 &&
gEditor.getCaretPosition().col == 44 + token.length,
"The editor shouldn't jump to another token. (12.3)");
write(":1:2:3:a:b:c:::12");
ok(gEditor.getCaretPosition().line == 11 &&
gEditor.getCaretPosition().col == 0,