Merge 60a2a71a0a4c717f5fc02491eac49224bf0f1294 into c5b47e88ac2c8f08371691b32adc206c0f830669
This commit is contained in:
commit
d537056849
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -181,6 +181,21 @@ module.exports = function() {
|
||||
return this.beginning.next_cl;
|
||||
};
|
||||
|
||||
ListManager.prototype.getNext = function(start) {
|
||||
var o;
|
||||
o = start.next_cl;
|
||||
while (!(o instanceof ops.Delimiter)) {
|
||||
if (o.is_deleted) {
|
||||
o = o.next_cl;
|
||||
} else if (o instanceof ops.Delimiter) {
|
||||
return false;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
};
|
||||
|
||||
ListManager.prototype.toArray = function() {
|
||||
var o, result;
|
||||
o = this.beginning.next_cl;
|
||||
@ -273,6 +288,16 @@ module.exports = function() {
|
||||
return this.insertAfter(this.end.prev_cl, [content]);
|
||||
};
|
||||
|
||||
ListManager.prototype.insertAfterHelper = function(root, content) {
|
||||
var right;
|
||||
if (!root.right) {
|
||||
root.bt.right = content;
|
||||
return content.bt.parent = root;
|
||||
} else {
|
||||
return right = root.next_cl;
|
||||
}
|
||||
};
|
||||
|
||||
ListManager.prototype.insertAfter = function(left, contents) {
|
||||
var c, j, len, right, tmp;
|
||||
right = left.next_cl;
|
||||
@ -301,12 +326,11 @@ module.exports = function() {
|
||||
return this.insertAfter(ith, contents);
|
||||
};
|
||||
|
||||
ListManager.prototype["delete"] = function(position, length) {
|
||||
var d, delete_ops, i, j, o, ref;
|
||||
ListManager.prototype.deleteRef = function(o, length) {
|
||||
var d, delete_ops, i, j, ref;
|
||||
if (length == null) {
|
||||
length = 1;
|
||||
}
|
||||
o = this.getOperationByPosition(position + 1);
|
||||
delete_ops = [];
|
||||
for (i = j = 0, ref = length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
||||
if (o instanceof ops.Delimiter) {
|
||||
@ -322,6 +346,15 @@ module.exports = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
ListManager.prototype["delete"] = function(position, length) {
|
||||
var o;
|
||||
if (length == null) {
|
||||
length = 1;
|
||||
}
|
||||
o = this.getOperationByPosition(position + 1);
|
||||
return this.deleteRef(o, length);
|
||||
};
|
||||
|
||||
ListManager.prototype.callOperationSpecificInsertEvents = function(op) {
|
||||
var getContentType;
|
||||
getContentType = function(content) {
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -155,6 +155,19 @@ module.exports = ()->
|
||||
getFirstOperation: ()->
|
||||
@beginning.next_cl
|
||||
|
||||
# get the next non-deleted operation
|
||||
getNext: (start)->
|
||||
o = start.next_cl
|
||||
while not ((o instanceof ops.Delimiter))
|
||||
if o.is_deleted
|
||||
o = o.next_cl
|
||||
else if o instanceof ops.Delimiter
|
||||
return false
|
||||
else break
|
||||
|
||||
o
|
||||
|
||||
|
||||
# Transforms the the list to an array
|
||||
# Doesn't return left-right delimiter.
|
||||
toArray: ()->
|
||||
@ -232,6 +245,14 @@ module.exports = ()->
|
||||
push: (content)->
|
||||
@insertAfter @end.prev_cl, [content]
|
||||
|
||||
insertAfterHelper: (root, content)->
|
||||
if !root.right
|
||||
root.bt.right = content
|
||||
content.bt.parent = root
|
||||
else
|
||||
right = root.next_cl
|
||||
|
||||
|
||||
insertAfter: (left, contents)->
|
||||
right = left.next_cl
|
||||
while right.isDeleted()
|
||||
@ -266,9 +287,8 @@ module.exports = ()->
|
||||
#
|
||||
# @return {ListManager Type} This String object
|
||||
#
|
||||
delete: (position, length = 1)->
|
||||
o = @getOperationByPosition(position+1) # position 0 in this case is the deletion of the first character
|
||||
|
||||
deleteRef: (o, length = 1) ->
|
||||
delete_ops = []
|
||||
for i in [0...length]
|
||||
if o instanceof ops.Delimiter
|
||||
@ -280,6 +300,11 @@ module.exports = ()->
|
||||
delete_ops.push d._encode()
|
||||
@
|
||||
|
||||
delete: (position, length = 1)->
|
||||
o = @getOperationByPosition(position+1) # position 0 in this case is the deletion of the first character
|
||||
|
||||
@deleteRef o, length
|
||||
|
||||
|
||||
callOperationSpecificInsertEvents: (op)->
|
||||
getContentType = (content)->
|
||||
|
Loading…
x
Reference in New Issue
Block a user