Fixing some index bugs with edits api for custom editors

This commit is contained in:
Matt Bierner
2020-03-23 14:45:31 -07:00
parent 84b5597e3e
commit ebb2030e1d
3 changed files with 16 additions and 10 deletions

View File

@@ -673,11 +673,10 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
}
const undoneEdit = this._edits[this._currentEditIndex];
await this._proxy.$undo(this._editorResource, this.viewType, undoneEdit, this.getEditState());
this.change(() => {
--this._currentEditIndex;
});
await this._proxy.$undo(this._editorResource, this.viewType, undoneEdit, this.getEditState());
}
private getEditState(): extHostProtocol.CustomDocumentEditState {
@@ -699,10 +698,10 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
}
const redoneEdit = this._edits[this._currentEditIndex + 1];
await this._proxy.$redo(this._editorResource, this.viewType, redoneEdit, this.getEditState());
this.change(() => {
++this._currentEditIndex;
});
await this._proxy.$redo(this._editorResource, this.viewType, redoneEdit, this.getEditState());
}
private spliceEdits(editToInsert?: number) {