Rename the 'delete' delta action to 'remove'
Matches previous naming convention.
This commit is contained in:
parent
6fe381f633
commit
f2a2e4e1a8
10 changed files with 24 additions and 24 deletions
|
|
@ -133,7 +133,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
}
|
||||
|
||||
// DELTA ENVELOPS POINT (delete only): Move point to delta start.
|
||||
if (delta.action != 'delete')
|
||||
if (delta.action != 'remove')
|
||||
throw 'Delete action expected.';
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ function throwDeltaError(delta, errorText){
|
|||
function validateDelta(lines, delta) {
|
||||
|
||||
// Validate action.
|
||||
if (delta.action != 'insert' && delta.action != 'delete')
|
||||
fnThrow('Delta action must be "insert" or "delete".');
|
||||
if (delta.action != 'insert' && delta.action != 'remove')
|
||||
fnThrow('Delta action must be "insert" or "remove".');
|
||||
|
||||
// Validate lines.
|
||||
if (!delta.lines instanceof Array)
|
||||
|
|
@ -103,7 +103,7 @@ exports.applyDelta = function(lines, delta) {
|
|||
lines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'remove':
|
||||
lines[row] = line.substring(0, startColumn) + line.substring(endColumn);
|
||||
break;
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ exports.applyDelta = function(lines, delta) {
|
|||
joinLineWithNext(lines, delta.range.end.row);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'remove':
|
||||
splitLine(lines, delta.range.end);
|
||||
splitLine(lines, delta.range.start);
|
||||
lines.splice(
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
|
||||
if (len === 0) {
|
||||
this.lines[startRow] = null;
|
||||
} else if (delta.action == "delete") {
|
||||
} else if (delta.action == 'remove') {
|
||||
this.lines.splice(startRow, len + 1, null);
|
||||
this.states.splice(startRow, len + 1, null);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ var Document = function(textOrLines) {
|
|||
* * `"insert"`
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `lines`: the lines being added
|
||||
* * `"delete"`
|
||||
* * `"remove"`
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `lines`: the lines being removed
|
||||
*
|
||||
|
|
@ -395,7 +395,7 @@ var Document = function(textOrLines) {
|
|||
// Apply delta (emits change).
|
||||
range = this.$getClippedRange(range);
|
||||
this.applyDelta({
|
||||
action: 'delete',
|
||||
action: 'remove',
|
||||
range: range,
|
||||
lines: this.getLinesForRange(range),
|
||||
});
|
||||
|
|
@ -418,7 +418,7 @@ var Document = function(textOrLines) {
|
|||
|
||||
// Apply delta (emits change).
|
||||
this.applyDelta({
|
||||
action: "delete",
|
||||
action: 'remove',
|
||||
range: range,
|
||||
lines: this.getLinesForRange(range)
|
||||
});
|
||||
|
|
@ -455,7 +455,7 @@ var Document = function(textOrLines) {
|
|||
|
||||
// Apply delta (emits change).
|
||||
this.applyDelta({
|
||||
action: "delete",
|
||||
action: 'remove',
|
||||
range: range,
|
||||
lines: this.getLinesForRange(range)
|
||||
});
|
||||
|
|
@ -474,7 +474,7 @@ var Document = function(textOrLines) {
|
|||
if (row < this.getLength() - 1 && row >= 0) {
|
||||
// Apply delta (emits change).
|
||||
this.applyDelta({
|
||||
action: "delete",
|
||||
action: 'remove',
|
||||
range: new Range(row, this.getLine(row).length, row + 1, 0),
|
||||
lines: ['', '']
|
||||
});
|
||||
|
|
@ -516,7 +516,7 @@ var Document = function(textOrLines) {
|
|||
|
||||
/**
|
||||
* Applies all changes in `deltas` to the document.
|
||||
* @param {Array} deltas An array of delta objects (can include 'insert' and 'delete' actions)
|
||||
* @param {Array} deltas An array of delta objects (can include 'insert' and 'remove' actions)
|
||||
**/
|
||||
this.applyDeltas = function(deltas) {
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
|
|
@ -526,7 +526,7 @@ var Document = function(textOrLines) {
|
|||
|
||||
/**
|
||||
* Reverts all changes in `deltas` from the document.
|
||||
* @param {Array} deltas An array of delta objects (can include 'insert' and 'delete' actions)
|
||||
* @param {Array} deltas An array of delta objects (can include 'insert' and 'remove' actions)
|
||||
**/
|
||||
this.revertDeltas = function(deltas) {
|
||||
for (var i=deltas.length-1; i>=0; i--) {
|
||||
|
|
@ -536,7 +536,7 @@ var Document = function(textOrLines) {
|
|||
|
||||
/**
|
||||
* Applies `delta` to the document.
|
||||
* @param {Object} delta A delta object (can include 'insert' and 'delete' actions)
|
||||
* @param {Object} delta A delta object (can include 'insert' and 'remove' actions)
|
||||
**/
|
||||
this.applyDelta = function(delta) {
|
||||
applyDelta(this.$lines, delta);
|
||||
|
|
@ -545,12 +545,12 @@ var Document = function(textOrLines) {
|
|||
|
||||
/**
|
||||
* Reverts `delta` from the document.
|
||||
* @param {Object} delta A delta object (can include 'insert' and 'delete' actions)
|
||||
* @param {Object} delta A delta object (can include 'insert' and 'remove' actions)
|
||||
**/
|
||||
this.revertDelta = function(delta)
|
||||
{
|
||||
this.applyDelta({
|
||||
action: (delta.action == 'insert' ? 'delete' : 'insert'),
|
||||
action: (delta.action == 'insert' ? 'remove' : 'insert'),
|
||||
range: delta.range.clone(),
|
||||
lines: delta.lines.slice()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1685,7 +1685,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
this.$updating = true;
|
||||
if (len != 0) {
|
||||
if (action == "delete") {
|
||||
if (action == 'remove') {
|
||||
this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
|
||||
|
||||
var foldLines = this.$foldData;
|
||||
|
|
@ -1760,7 +1760,7 @@ var EditSession = function(text, mode) {
|
|||
// Realign folds. E.g. if you add some new chars before a fold, the
|
||||
// fold should "move" to the right.
|
||||
len = Math.abs(e.data.range.start.column - e.data.range.end.column);
|
||||
if (action == "delete") {
|
||||
if (action == 'remove') {
|
||||
// Get all the folds in the change range and remove them.
|
||||
removedFolds = this.getFoldsInRange(e.data.range);
|
||||
this.removeFolds(removedFolds);
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ function Folding() {
|
|||
|
||||
if (len === 0) {
|
||||
this.foldWidgets[firstRow] = null;
|
||||
} else if (delta.action == "delete") {
|
||||
} else if (delta.action == 'remove') {
|
||||
this.foldWidgets.splice(firstRow, len + 1, null);
|
||||
} else {
|
||||
var args = Array(len + 1);
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ var onSelectionChange = function(evt) {
|
|||
var onChange = function(evt) {
|
||||
var data = evt.data;
|
||||
switch (data.action) {
|
||||
case 'delete':
|
||||
case 'remove':
|
||||
cvox.Api.speak(data.text, 0, DELETED_PROP);
|
||||
/* Let the future cursor change event know it's from text change. */
|
||||
changed = true;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ var Gutter = function(parentEl) {
|
|||
var len = range.end.row - firstRow;
|
||||
if (len === 0) {
|
||||
// do nothing
|
||||
} else if (delta.action == "delete") {
|
||||
} else if (delta.action == 'remove') {
|
||||
this.$annotations.splice(firstRow, len + 1, null);
|
||||
} else {
|
||||
var args = new Array(len + 1);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ function LineWidgets(session) {
|
|||
|
||||
if (len === 0) {
|
||||
// return
|
||||
} else if (delta.action == "delete") {
|
||||
} else if (delta.action == 'remove') {
|
||||
var removed = cells.splice(startRow + 1, len);
|
||||
removed.forEach(function(w) {
|
||||
w && this.removeLineWidget(w);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
newPos.column += lengthDiff;
|
||||
this.doc.insertMergedLines(newPos, delta.lines);
|
||||
}
|
||||
} else if(delta.action === "delete") {
|
||||
} else if(delta.action === 'remove') {
|
||||
for (var i = this.others.length - 1; i >= 0; i--) {
|
||||
var otherPos = this.others[i];
|
||||
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
|
||||
|
|
@ -191,7 +191,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
}
|
||||
}.bind(this), 0);
|
||||
}
|
||||
else if(range.start.column === this.pos.column && delta.action === "delete") {
|
||||
else if(range.start.column === this.pos.column && delta.action === 'remove') {
|
||||
setTimeout(function() {
|
||||
for (var i = 0; i < this.others.length; i++) {
|
||||
var other = this.others[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue