提交 413bcb9f 编写于 作者: A Alex Dima

Fixes #3071

上级 3b108af8
...@@ -85,7 +85,9 @@ export class EditableTextModel extends TextModelWithDecorations implements edito ...@@ -85,7 +85,9 @@ export class EditableTextModel extends TextModelWithDecorations implements edito
throw new Error('EditableTextModel.pushEditOperations: Model is disposed'); throw new Error('EditableTextModel.pushEditOperations: Model is disposed');
} }
return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer); return this.deferredEmit(() => {
return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);
});
} }
/** /**
......
...@@ -1089,6 +1089,48 @@ suite('Editor Controller - Regression tests', () => { ...@@ -1089,6 +1089,48 @@ suite('Editor Controller - Regression tests', () => {
}); });
}); });
test('issue #3071: Investigate why undo stack gets corrupted', () => {
usingCursor({
text: [
'some lines',
'and more lines',
'just some text',
],
mode: null,
config: null
}, (model, cursor) => {
moveTo(cursor, 1, 1, false);
moveTo(cursor, 3, 4, true);
let isFirst = true;
model.addListener2(EventType.ModelContentChanged, (e) => {
if (isFirst) {
isFirst = false;
cursorCommand(cursor, H.Type, { text: '\t' }, null, 'keyboard');
}
});
cursorCommand(cursor, H.Tab);
assert.equal(model.getValue(), [
'\t just some text'
].join('\n'), '001');
cursorCommand(cursor, H.Undo);
assert.equal(model.getValue(), [
'some lines',
'and more lines',
'just some text',
].join('\n'), '002');
cursorCommand(cursor, H.Undo);
assert.equal(model.getValue(), [
'some lines',
'and more lines',
'just some text',
].join('\n'), '003');
});
});
test('issue #832: deleteWordLeft', () => { test('issue #832: deleteWordLeft', () => {
usingCursor({ usingCursor({
text: [ text: [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册