navigate line start: toggle between line start and text start
This commit is contained in:
parent
043dfa705e
commit
3e28057caf
1 changed files with 6 additions and 4 deletions
|
|
@ -260,11 +260,13 @@ var Selection = function(doc) {
|
||||||
var row = this.selectionLead.row;
|
var row = this.selectionLead.row;
|
||||||
var column = this.selectionLead.column;
|
var column = this.selectionLead.column;
|
||||||
var beforeCursor = this.doc.getLine(row).slice(0, column);
|
var beforeCursor = this.doc.getLine(row).slice(0, column);
|
||||||
var leadingSpace = beforeCursor.match(/^\s+/);
|
var leadingSpace = beforeCursor.match(/^\s*/);
|
||||||
if (!leadingSpace || leadingSpace[0].length >= column)
|
if (leadingSpace[0].length == 0)
|
||||||
this.moveCursorTo(this.selectionLead.row, 0);
|
this.moveCursorTo(row, this.doc.getLine(row).match(/^\s*/)[0].length);
|
||||||
|
else if (leadingSpace[0].length >= column)
|
||||||
|
this.moveCursorTo(row, 0);
|
||||||
else
|
else
|
||||||
this.moveCursorTo(this.selectionLead.row, leadingSpace[0].length);
|
this.moveCursorTo(row, leadingSpace[0].length);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorLineEnd = function() {
|
this.moveCursorLineEnd = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue