backspace should eat 4 spaces when the cursor is positioned after a tab
(also for navigation and selection)
This commit is contained in:
parent
16b12da3e3
commit
b6bd3fb726
4 changed files with 52 additions and 5 deletions
|
|
@ -265,13 +265,20 @@ var Selection = function(doc) {
|
|||
|
||||
this.moveCursorLeft = function() {
|
||||
if (this.selectionLead.column == 0) {
|
||||
// cursor is a line start
|
||||
if (this.selectionLead.row > 0) {
|
||||
this.moveCursorTo(this.selectionLead.row - 1, this.doc
|
||||
.getLine(this.selectionLead.row - 1).length);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.moveCursorBy(0, -1);
|
||||
var doc = this.doc;
|
||||
var tabSize = doc.getTabSize();
|
||||
var cursor = this.selectionLead;
|
||||
if (doc.isTabStop(cursor) && doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
|
||||
this.moveCursorBy(0, -tabSize);
|
||||
else
|
||||
this.moveCursorBy(0, -1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -282,7 +289,13 @@ var Selection = function(doc) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
this.moveCursorBy(0, 1);
|
||||
var doc = this.doc;
|
||||
var tabSize = doc.getTabSize();
|
||||
var cursor = this.selectionLead;
|
||||
if (doc.isTabStop(cursor) && doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
|
||||
this.moveCursorBy(0, tabSize);
|
||||
else
|
||||
this.moveCursorBy(0, 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue