selectWordRight at the end of line should select whitespace on next line

This commit is contained in:
nightwing 2012-06-01 18:05:47 +04:00
commit 1b981f1793

View file

@ -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);