Merge branch 'cursor' into staging

This commit is contained in:
yflory committed 2018-11-19 15:22:35 +01:00
commit 3d712d9008
3 files changed
+38 -6

No files matched your search

+9 -6
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;
}
}*/
}
}
},