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)
|
||||
return this.moveCursorTo(fold.end.row, fold.end.column);
|
||||
|
||||
if (column == line.length)
|
||||
return this.moveCursorRight();
|
||||
if (column == line.length) {
|
||||
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);
|
||||
|
||||
|
|
@ -738,11 +747,19 @@ var Selection = function(session) {
|
|||
if (fold = this.session.getFoldAt(row, column, -1))
|
||||
return this.moveCursorTo(fold.start.row, fold.start.column);
|
||||
|
||||
if (column == 0)
|
||||
return this.moveCursorLeft();
|
||||
var line = this.session.getLine(row).substring(0, column);
|
||||
if (column == 0) {
|
||||
do {
|
||||
row--;
|
||||
line = this.doc.getLine(row);
|
||||
} while (row > 0 && /^\s*$/.test(line))
|
||||
|
||||
column = line.length;
|
||||
if (!/\s+$/.test(line))
|
||||
line = ""
|
||||
}
|
||||
|
||||
var str = this.session.getLine(row).substring(0, column);
|
||||
var leftOfCursor = lang.stringReverse(str);
|
||||
var leftOfCursor = lang.stringReverse(line);
|
||||
var index = this.$shortWordEndIndex(leftOfCursor);
|
||||
|
||||
return this.moveCursorTo(row, column - index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue