[incremental search] fixing status-message-remove-last-char bug

This commit is contained in:
Robert Krahn 2013-03-17 06:04:19 -07:00
commit 832d30c97c

View file

@ -73,10 +73,7 @@ oop.inherits(IncrementalSearch, Search);
editor.keyBinding.addKeyboardHandler(this.$keyboardHandler);
this.$mousedownHandler = editor.addEventListener('mousedown', this.onMouseDown.bind(this));
this.selectionFix(editor);
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
var msg = this.$options.backwards ? 'reverse-' : '';
msg += 'isearch: ' + this.$options.needle;
this.message(msg);
this.statusMessage(true);
}
this.deactivate = function(reset) {
@ -121,7 +118,10 @@ oop.inherits(IncrementalSearch, Search);
if (needleUpdateFunc) {
options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
}
if (options.needle.length === 0) return this.cancelSearch(true);
if (options.needle.length === 0) {
this.statusMessage(true);
return this.cancelSearch(true);
};
// try to find the next occurence and enable highlighting marker
options.start = this.$currentPos;
@ -137,10 +137,7 @@ oop.inherits(IncrementalSearch, Search);
this.$editor.renderer.updateBackMarkers();
}
var msg = options.backwards ? 'reverse-' : '';
msg += 'isearch: ' + options.needle;
if (!found) msg += ' (not found)';
this.message(msg);
this.statusMessage(found);
return found;
}
@ -176,6 +173,14 @@ oop.inherits(IncrementalSearch, Search);
return true;
}
this.statusMessage = function(found) {
var options = this.$options, msg = '';
msg += options.backwards ? 'reverse-' : '';
msg += 'isearch: ' + options.needle;
msg += found ? '' : ' (not found)';
this.message(msg);
}
this.message = function(msg) {
var cmdLine = this.$editor && this.$editor.cmdLine;
if (cmdLine) {