diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 72484840..8a62ffe2 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -1800,6 +1800,10 @@ var Editor = function(renderer, session) { * **/ this.navigateUp = function(times) { + if (!this.selection.isEmpty() && !this.selection.isBackwards()) { + var selectionStart = this.selection.anchor.getPosition(); + return this.moveCursorToPosition(selectionStart); + } this.selection.clearSelection(); times = times || 1; this.selection.moveCursorBy(-times, 0); @@ -1812,6 +1816,10 @@ var Editor = function(renderer, session) { * **/ this.navigateDown = function(times) { + if (!this.selection.isEmpty() && this.selection.isBackwards()) { + var selectionEnd = this.selection.anchor.getPosition(); + return this.moveCursorToPosition(selectionEnd); + } this.selection.clearSelection(); times = times || 1; this.selection.moveCursorBy(times, 0); @@ -2220,4 +2228,4 @@ config.defineOptions(Editor.prototype, "editor", { }); exports.Editor = Editor; -}); +}); \ No newline at end of file