selectWordRight at the end of line should select whitespace on next line
This commit is contained in:
parent
231e5a7cb7
commit
1b981f1793
1 changed files with 23 additions and 6 deletions
|
|
@ -722,8 +722,17 @@ var Selection = function(session) {
|
||||||
if (fold)
|
if (fold)
|
||||||
return this.moveCursorTo(fold.end.row, fold.end.column);
|
return this.moveCursorTo(fold.end.row, fold.end.column);
|
||||||
|
|
||||||
if (column == line.length)
|
if (column == line.length) {
|
||||||
return this.moveCursorRight();
|
var l = this.doc.getLength();
|
||||||
|
do {
|
||||||
|
row++;
|
||||||
|
rightOfCursor = this.doc.getLine(row)
|
||||||
|
} while (row < l && /^\s*$/.test(rightOfCursor))
|
||||||
|
|
||||||
|
if (!/^\s+/.test(rightOfCursor))
|
||||||
|
rightOfCursor = ""
|
||||||
|
column = 0;
|
||||||
|
}
|
||||||
|
|
||||||
var index = this.$shortWordEndIndex(rightOfCursor);
|
var index = this.$shortWordEndIndex(rightOfCursor);
|
||||||
|
|
||||||
|
|
@ -738,11 +747,19 @@ var Selection = function(session) {
|
||||||
if (fold = this.session.getFoldAt(row, column, -1))
|
if (fold = this.session.getFoldAt(row, column, -1))
|
||||||
return this.moveCursorTo(fold.start.row, fold.start.column);
|
return this.moveCursorTo(fold.start.row, fold.start.column);
|
||||||
|
|
||||||
if (column == 0)
|
var line = this.session.getLine(row).substring(0, column);
|
||||||
return this.moveCursorLeft();
|
if (column == 0) {
|
||||||
|
do {
|
||||||
|
row--;
|
||||||
|
line = this.doc.getLine(row);
|
||||||
|
} while (row > 0 && /^\s*$/.test(line))
|
||||||
|
|
||||||
var str = this.session.getLine(row).substring(0, column);
|
column = line.length;
|
||||||
var leftOfCursor = lang.stringReverse(str);
|
if (!/\s+$/.test(line))
|
||||||
|
line = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var leftOfCursor = lang.stringReverse(line);
|
||||||
var index = this.$shortWordEndIndex(leftOfCursor);
|
var index = this.$shortWordEndIndex(leftOfCursor);
|
||||||
|
|
||||||
return this.moveCursorTo(row, column - index);
|
return this.moveCursorTo(row, column - index);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue