diff --git a/lib/ace/incremental_search.js b/lib/ace/incremental_search.js index 88615006..ee74f60d 100644 --- a/lib/ace/incremental_search.js +++ b/lib/ace/incremental_search.js @@ -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)