cleanup
This commit is contained in:
parent
525fe1ffe3
commit
bacaeb07d8
1 changed files with 14 additions and 14 deletions
|
|
@ -227,7 +227,7 @@ var Document = function(textOrLines) {
|
|||
var lines;
|
||||
if (range.start.row === range.end.row) {
|
||||
// Handle a single-line range.
|
||||
lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
|
||||
lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
|
||||
} else {
|
||||
// Handle a multi-line range.
|
||||
lines = this.getLines(range.start.row, range.end.row);
|
||||
|
|
@ -287,9 +287,9 @@ var Document = function(textOrLines) {
|
|||
var end = this.pos(position.row, position.column + text.length);
|
||||
|
||||
this.applyDelta({
|
||||
action: "insert",
|
||||
start: start,
|
||||
end: end,
|
||||
action: "insert",
|
||||
lines: [text]
|
||||
}, true);
|
||||
|
||||
|
|
@ -408,9 +408,9 @@ var Document = function(textOrLines) {
|
|||
};
|
||||
|
||||
this.applyDelta({
|
||||
action: "insert",
|
||||
start: position,
|
||||
end: endPoint,
|
||||
action: "insert",
|
||||
lines: lines
|
||||
});
|
||||
|
||||
|
|
@ -427,10 +427,10 @@ var Document = function(textOrLines) {
|
|||
var start = this.clippedPos(range.start.row, range.start.column);
|
||||
var end = this.clippedPos(range.end.row, range.end.column);
|
||||
this.applyDelta({
|
||||
action: "remove",
|
||||
start: start,
|
||||
end: end,
|
||||
lines: this.getLinesForRange({start: start, end: end}),
|
||||
action: "remove",
|
||||
lines: this.getLinesForRange({start: start, end: end})
|
||||
});
|
||||
return this.clonePos(start);
|
||||
};
|
||||
|
|
@ -448,10 +448,10 @@ var Document = function(textOrLines) {
|
|||
var end = this.clippedPos(row, endColumn);
|
||||
|
||||
this.applyDelta({
|
||||
action: "remove",
|
||||
start: start,
|
||||
end: end,
|
||||
lines: this.getLinesForRange({start: start, end: end}),
|
||||
action: "remove",
|
||||
lines: this.getLinesForRange({start: start, end: end})
|
||||
}, true);
|
||||
|
||||
return this.clonePos(start);
|
||||
|
|
@ -484,9 +484,9 @@ var Document = function(textOrLines) {
|
|||
var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
|
||||
|
||||
this.applyDelta({
|
||||
action: "remove",
|
||||
start: range.start,
|
||||
end: range.end,
|
||||
action: "remove",
|
||||
lines: this.getLinesForRange(range)
|
||||
});
|
||||
|
||||
|
|
@ -500,11 +500,11 @@ var Document = function(textOrLines) {
|
|||
*
|
||||
**/
|
||||
this.removeNewLine = function(row) {
|
||||
if (row < this.getLength() - 1 && row >= 0) {
|
||||
if (row < this.getLength() - 1 && row >= 0) {
|
||||
this.applyDelta({
|
||||
action: "remove",
|
||||
start: this.pos(row, this.getLine(row).length),
|
||||
end: this.pos(row + 1, 0),
|
||||
action: "remove",
|
||||
lines: ["", ""]
|
||||
});
|
||||
}
|
||||
|
|
@ -598,10 +598,10 @@ var Document = function(textOrLines) {
|
|||
lines.push("");
|
||||
var start = delta.start;
|
||||
this.applyDelta({
|
||||
action: delta.action,
|
||||
lines: lines,
|
||||
start: this.pos(start.row, start.column),
|
||||
end: this.pos(start.row += 0xF000, start.column = 0) // Updates remaining delta.
|
||||
end: this.pos(start.row += 0xF000, start.column = 0), // Updates remaining delta.
|
||||
action: delta.action,
|
||||
lines: lines
|
||||
}, true);
|
||||
}
|
||||
};
|
||||
|
|
@ -613,9 +613,9 @@ var Document = function(textOrLines) {
|
|||
this.revertDelta = function(delta) {
|
||||
var range = Range.fromPoints(delta.start, delta.end);
|
||||
this.applyDelta({
|
||||
action: (delta.action == "insert" ? "remove" : "insert"),
|
||||
start: range.start,
|
||||
end: range.end,
|
||||
action: delta.action == "insert" ? "remove" : "insert",
|
||||
lines: delta.lines.slice()
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue