[incremental search] renderer update for highlight markers

This commit is contained in:
Robert Krahn 2013-03-10 12:45:36 -07:00
commit 2faf912234

View file

@ -83,13 +83,12 @@ oop.inherits(IncrementalSearch, Search);
var e = this.$editor;
this.$prevNeedle = this.$options.needle;
this.$options.needle = '';
e.session.highlight(null);
if (reset) {
e.moveCursorToPosition(this.$startPos);
this.$currentPos = this.$startPos;
} else {
e.renderer.updateFull(true); // for highlight
}
e.session.highlight(null);
this.$editor.renderer.updateBackMarkers(); // force highlight layer redraw
return Range.fromPoints(this.$currentPos, this.$currentPos);
}
@ -105,11 +104,11 @@ oop.inherits(IncrementalSearch, Search);
options.start = this.$currentPos;
var session = this.$editor.session,
found = this.find(session);
session.highlight(options.re);
this.$editor.renderer.updateFull(true); // force highlight layer redraw
if (found) {
if (options.backwards) found = Range.fromPoints(found.end, found.start);
session.highlight(options.re);
this.$editor.moveCursorToPosition(found.end);
this.$editor.renderer.updateBackMarkers(); // force highlight layer redraw
if (moveToNext) this.$currentPos = found.end;
}
console.log("searching %s from [%s/%s]: %s",
@ -163,6 +162,7 @@ oop.inherits(IncrementalSearch, Search);
if (key === 'backspace') { this.removeChar(); result = stop; }
if (key === 'return') { this.deactivate(); this.message(''); return stop; }
if (key === 'esc') { this.deactivate(true); this.message(''); return stop; }
if (key === 'space') { this.addChar(" "); result = stop; }
if (key.length === 1) { this.addChar(key); result = stop; }
}