mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 18:06:15 -04:00
Changeset: Fix off-by-one bug in makeSplice
This commit is contained in:
parent
30d68df396
commit
748d661495
2 changed files with 8 additions and 1 deletions
|
@ -1493,7 +1493,7 @@ exports.identity = (N) => exports.pack(N, N, '', '');
|
|||
exports.makeSplice = (orig, start, ndel, ins, attribs, pool) => {
|
||||
if (start < 0) throw new RangeError(`start index must be non-negative (is ${start})`);
|
||||
if (ndel < 0) throw new RangeError(`characters to delete must be non-negative (is ${ndel})`);
|
||||
if (start >= orig.length) start = orig.length - 1;
|
||||
if (start > orig.length) start = orig.length;
|
||||
if (ndel > orig.length - start) ndel = orig.length - start;
|
||||
const deleted = orig.substring(start, start + ndel);
|
||||
const assem = exports.smartOpAssembler();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue