highlight last search result when searchbox is focused
This commit is contained in:
parent
cc01912250
commit
689ebf8b48
1 changed files with 7 additions and 1 deletions
|
|
@ -122,9 +122,11 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
});
|
||||
event.addListener(this.searchInput, "focus", function() {
|
||||
_this.activeInput = _this.searchInput;
|
||||
_this.searchInput.value && _this.highlight();
|
||||
});
|
||||
event.addListener(this.replaceInput, "focus", function() {
|
||||
_this.activeInput = _this.replaceInput;
|
||||
_this.searchInput.value && _this.highlight();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -199,6 +201,10 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
this.find(false, false);
|
||||
};
|
||||
|
||||
this.highlight = function(re) {
|
||||
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
||||
this.editor.renderer.updateBackMarkers()
|
||||
};
|
||||
this.find = function(skipCurrent, backwards) {
|
||||
var range = this.editor.find(this.searchInput.value, {
|
||||
skipCurrent: skipCurrent,
|
||||
|
|
@ -209,7 +215,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
wholeWord: this.wholeWordOption.checked
|
||||
});
|
||||
dom.setCssClass(this.searchBox, "ace_nomatch", !range && this.searchInput.value);
|
||||
this.editor.session.highlight(this.editor.$search.$options.re);
|
||||
this.highlight();
|
||||
};
|
||||
this.findNext = function() {
|
||||
this.find(true, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue