mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-02 14:04:01 +01:00
Correct sorting of edits before applying changes
This commit is contained in:
@@ -1199,7 +1199,16 @@ class Buffer {
|
||||
return prevLeaf;
|
||||
}
|
||||
|
||||
private static _compareEdits(a: OffsetLenEdit, b: OffsetLenEdit): number {
|
||||
if (a.offset === b.offset) {
|
||||
return (a.initialIndex - b.initialIndex);
|
||||
}
|
||||
return a.offset - b.offset;
|
||||
}
|
||||
|
||||
public replaceOffsetLen(_edits: OffsetLenEdit[]): void {
|
||||
_edits.sort(Buffer._compareEdits);
|
||||
|
||||
const initialLeafLength = this._leafs.length;
|
||||
const edits = this._resolveEdits(_edits);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user