[incremental search] quit isearch on mousedown
This commit is contained in:
parent
0bbfdafec3
commit
569563aa5f
1 changed files with 12 additions and 1 deletions
|
|
@ -71,6 +71,7 @@ oop.inherits(IncrementalSearch, Search);
|
||||||
this.$options.needle = '';
|
this.$options.needle = '';
|
||||||
this.$options.backwards = backwards;
|
this.$options.backwards = backwards;
|
||||||
editor.keyBinding.addKeyboardHandler(this.$keyboardHandler);
|
editor.keyBinding.addKeyboardHandler(this.$keyboardHandler);
|
||||||
|
this.$mousedownHandler = editor.addEventListener('mousedown', this.onMouseDown.bind(this));
|
||||||
this.selectionFix(editor);
|
this.selectionFix(editor);
|
||||||
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
var msg = this.$options.backwards ? 'reverse-' : '';
|
var msg = this.$options.backwards ? 'reverse-' : '';
|
||||||
|
|
@ -81,6 +82,10 @@ oop.inherits(IncrementalSearch, Search);
|
||||||
this.deactivate = function(reset) {
|
this.deactivate = function(reset) {
|
||||||
this.cancelSearch(reset);
|
this.cancelSearch(reset);
|
||||||
this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
|
this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
|
||||||
|
if (this.$mousedownHandler) {
|
||||||
|
this.$editor.removeEventListener('mousedown', this.$mousedownHandler);
|
||||||
|
delete this.$mousedownHandler;
|
||||||
|
}
|
||||||
this.message('');
|
this.message('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,6 +99,7 @@ oop.inherits(IncrementalSearch, Search);
|
||||||
editor.clearSelection();
|
editor.clearSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cancelSearch = function(reset) {
|
this.cancelSearch = function(reset) {
|
||||||
var e = this.$editor;
|
var e = this.$editor;
|
||||||
this.$prevNeedle = this.$options.needle;
|
this.$prevNeedle = this.$options.needle;
|
||||||
|
|
@ -164,6 +170,12 @@ oop.inherits(IncrementalSearch, Search);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onMouseDown = function(evt) {
|
||||||
|
// when mouse interaction happens then we quit incremental search
|
||||||
|
this.deactivate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
this.message = function(msg) {
|
this.message = function(msg) {
|
||||||
var cmdLine = this.$editor && this.$editor.cmdLine;
|
var cmdLine = this.$editor && this.$editor.cmdLine;
|
||||||
if (cmdLine) {
|
if (cmdLine) {
|
||||||
|
|
@ -173,7 +185,6 @@ oop.inherits(IncrementalSearch, Search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).call(IncrementalSearch.prototype);
|
}).call(IncrementalSearch.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue