From 78b2147c3c9cf5744863ea6db9273d6be05834a3 Mon Sep 17 00:00:00 2001 From: Robert Krahn Date: Mon, 24 Mar 2014 16:15:59 -0700 Subject: [PATCH] emacs/isearch: select when moving cursor via isearch and emacs mark is set --- lib/ace/incremental_search.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)