diff --git a/src/static/js/broadcast.js b/src/static/js/broadcast.js index 909b6a085..6ba2ef0ab 100644 --- a/src/static/js/broadcast.js +++ b/src/static/js/broadcast.js @@ -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) => {