From bacaeb07d81d0fd25ae6a8f597a4c4a5f8e1af55 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 11 Nov 2014 11:40:18 +0400 Subject: [PATCH] cleanup --- lib/ace/document.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/ace/document.js b/lib/ace/document.js index c5ccb71b..44897d7c 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -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() }); };