Merge branch 'cursor' into staging

This commit is contained in:
yflory
2018-11-19 15:22:35 +01:00
3 changed files with 38 additions and 6 deletions

View File

@@ -318,20 +318,23 @@ define([
if (!frame) { return; }
if (typeof info.diff.oldValue === 'string' && typeof info.diff.newValue === 'string') {
var pushes = cursor.pushDelta(info.diff.oldValue, info.diff.newValue);
if (frame && typeof info.diff.oldValue === 'string' && typeof info.diff.newValue === 'string') {
//var pushes = cursor.pushDelta(info.diff.oldValue, info.diff.newValue);
var ops = ChainPad.Diff.diff(info.diff.oldValue, info.diff.newValue);
if (frame & 1) {
// push cursor start if necessary
if (pushes.commonStart < cursor.Range.start.offset) {
cursor.transformRange(cursor.Range.start, ops);
/*if (pushes.commonStart < cursor.Range.start.offset) {
cursor.Range.start.offset += pushes.delta;
}
}*/
}
if (frame & 2) {
// push cursor end if necessary
if (pushes.commonStart < cursor.Range.end.offset) {
cursor.transformRange(cursor.Range.end, ops);
/*if (pushes.commonStart < cursor.Range.end.offset) {
cursor.Range.end.offset += pushes.delta;
}
}*/
}
}
},