diff --git a/lib/ace/incremental_search.js b/lib/ace/incremental_search.js index ddcde695..d1b8083f 100644 --- a/lib/ace/incremental_search.js +++ b/lib/ace/incremental_search.js @@ -106,10 +106,12 @@ oop.inherits(IncrementalSearch, Search); found = this.find(session); 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; + // highlight after cursor move, so selection works properly + // also force highlight layer redraw + session.highlight(options.re); + this.$editor.renderer.updateBackMarkers(); } console.log("searching %s from [%s/%s]: %s", options.backwards ? 'backwards' : 'forwards', @@ -155,7 +157,7 @@ oop.inherits(IncrementalSearch, Search); iSearch.handleKeyboard = function(data, hashId, key, keyCode) { this.message("data: " + data + ", hashId: " + hashId + ", key: " + key + ", keyCode: " + keyCode); - var stop = {command: 'null'}, result = undefined; + var stop = {command: 'null'}, result = stop; console.log(this.$options.needle); if (hashId === 0) {