emacs/isearch: select when moving cursor via isearch and emacs mark is set

This commit is contained in:
Robert Krahn 2014-03-24 16:15:59 -07:00
commit 78b2147c3c

View file

@ -140,10 +140,11 @@ oop.inherits(IncrementalSearch, Search);
// try to find the next occurence and enable highlighting marker
options.start = this.$currentPos;
var session = this.$editor.session,
found = this.find(session);
found = this.find(session),
shouldSelect = !!this.$editor.emacsMark();
if (found) {
if (options.backwards) found = Range.fromPoints(found.end, found.start);
this.$editor.moveCursorToPosition(found.end);
this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));
if (moveToNext) this.$currentPos = found.end;
// highlight after cursor move, so selection works properly
this.highlight(options.re)