repair regression
This commit is contained in:
parent
242cfb76eb
commit
39fcc4e65f
2 changed files with 19 additions and 1 deletions
|
|
@ -252,9 +252,20 @@ var Document = function(text, mode) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
return this.lines[row] || "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a line as it is displayed on screen. Tabs are replaced by spaces.
|
||||
*/
|
||||
this.getDisplayLine = function(row) {
|
||||
var tab = new Array(this.getTabSize()+1).join(" ");
|
||||
return this.lines[row].replace(/\t/g, tab);
|
||||
};
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.lines.slice(firstRow, lastRow+1);
|
||||
|
|
|
|||
|
|
@ -285,7 +285,14 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.moveCursorLineStart = function() {
|
||||
this.moveCursorTo(this.selectionLead.row, 0);
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
var beforeCursor = this.doc.getDisplayLine(row).slice(0, column);
|
||||
var leadingSpace = beforeCursor.match(/^\s+/);
|
||||
if (!leadingSpace || leadingSpace[0].length >= column)
|
||||
this.moveCursorTo(this.selectionLead.row, 0);
|
||||
else
|
||||
this.moveCursorTo(this.selectionLead.row, leadingSpace[0].length);
|
||||
};
|
||||
|
||||
this.moveCursorLineEnd = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue