isearch: being flexible about whether emacs mode is on or not

This commit is contained in:
Robert Krahn 2014-11-04 21:10:14 -08:00
commit 0a055cb725

View file

@ -141,7 +141,8 @@ oop.inherits(IncrementalSearch, Search);
options.start = this.$currentPos;
var session = this.$editor.session,
found = this.find(session),
shouldSelect = !!this.$editor.emacsMark();
shouldSelect = this.$editor.emacsMark ?
!!this.$editor.emacsMark() : !this.$editor.selection.isEmpty();
if (found) {
if (options.backwards) found = Range.fromPoints(found.end, found.start);
this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));