timeslider scrollTo: fixes wrong line number calculation in case there

are no attribute changes and no length changes
pull/5252/head
webzwo0i 2021-10-29 00:12:47 +02:00 committed by Richard Hansen
parent 9bad1d03d3
commit d8ca3a693d
1 changed files with 9 additions and 3 deletions

View File

@ -164,10 +164,16 @@ const loadBroadcastJS = (socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
return true; // break
}
});
// deal with someone is the author of a line and changes one character,
// so the alines won't change
// some chars are replaced (no attributes change and no length change)
// test if there are keep ops at the start of the cs
if (lineChanged === undefined) {
lineChanged = Changeset.opIterator(Changeset.unpack(changeset).ops).next().lines;
lineChanged = 0;
const opIter = Changeset.opIterator(Changeset.unpack(changeset).ops);
if (opIter.hasNext()) {
const op = opIter.next();
if (op.opcode === '=') lineChanged += op.lines;
}
}
const goToLineNumber = (lineNumber) => {