fix up/down arrow handling when selection is present
This commit is contained in:
parent
1b8fb10e50
commit
b4e9790763
1 changed files with 9 additions and 1 deletions
|
|
@ -1800,6 +1800,10 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.navigateUp = function(times) {
|
this.navigateUp = function(times) {
|
||||||
|
if (!this.selection.isEmpty() && !this.selection.isBackwards()) {
|
||||||
|
var selectionStart = this.selection.anchor.getPosition();
|
||||||
|
return this.moveCursorToPosition(selectionStart);
|
||||||
|
}
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
times = times || 1;
|
times = times || 1;
|
||||||
this.selection.moveCursorBy(-times, 0);
|
this.selection.moveCursorBy(-times, 0);
|
||||||
|
|
@ -1812,6 +1816,10 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.navigateDown = function(times) {
|
this.navigateDown = function(times) {
|
||||||
|
if (!this.selection.isEmpty() && this.selection.isBackwards()) {
|
||||||
|
var selectionEnd = this.selection.anchor.getPosition();
|
||||||
|
return this.moveCursorToPosition(selectionEnd);
|
||||||
|
}
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
times = times || 1;
|
times = times || 1;
|
||||||
this.selection.moveCursorBy(times, 0);
|
this.selection.moveCursorBy(times, 0);
|
||||||
|
|
@ -2220,4 +2228,4 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.Editor = Editor;
|
exports.Editor = Editor;
|
||||||
});
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue