Skip to content

Commit

Permalink
Bug 373955 - Find next/previous occurrence is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Li committed Mar 12, 2012
1 parent e32c4a0 commit e572302
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ orion.TextSearcher = (function() {

if(this.visible()){
return this.findOnce(searchStr ? searchStr : findTextDiv.value, startPos, (focusBackDiv && !dojo.isIE) ? function(){focusBackDiv.focus();} : null);
} else if(this._lastSearchString && this._lastSearchString.length > 0){
} else if(searchStr || (this._lastSearchString && this._lastSearchString.length > 0)){
var retVal = this._prepareFind(searchStr ? searchStr : this._lastSearchString, startPos);
return this._doFind(retVal.text, retVal.searchStr, retVal.startIndex, !next, this._wrapSearch);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ function(messages, mUndoStack, mKeyBinding, mRulers, mAnnotations, mTextDND, mRe
this.textView.setKeyBinding(new mKeyBinding.KeyBinding("k", true), messages.findNext);
this.textView.setAction(messages.findNext, function() {
if (this._searcher){
this._searcher.findNext(true);
var selection = this.textView.getSelection();
if(selection.start < selection.end) {
this._searcher.findNext(true, this.textView.getText(selection.start, selection.end));
} else {
this._searcher.findNext(true);
}
return true;
}
return false;
Expand All @@ -174,7 +179,12 @@ function(messages, mUndoStack, mKeyBinding, mRulers, mAnnotations, mTextDND, mRe
this.textView.setKeyBinding(new mKeyBinding.KeyBinding("k", true, true), messages.findPrevious);
this.textView.setAction(messages.findPrevious, function() {
if (this._searcher){
this._searcher.findNext(false);
var selection = this.textView.getSelection();
if(selection.start < selection.end) {
this._searcher.findNext(false, this.textView.getText(selection.start, selection.end));
} else {
this._searcher.findNext(false);
}
return true;
}
return false;
Expand Down

0 comments on commit e572302

Please sign in to comment.