From 57c2b8a28b96a387abef589472c58a48889ed59e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 18 May 2023 16:54:29 -0500 Subject: [PATCH] editor: add undo stop when switching model Since we share the same editor instance with multiple models, we need to ensure undo stack consistency when changing the model, otherwise we can lose some history, e.g. if a not active model is modified. --- src/editor/sagas.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/editor/sagas.ts b/src/editor/sagas.ts index 52ffb39b..b74c3676 100644 --- a/src/editor/sagas.ts +++ b/src/editor/sagas.ts @@ -265,8 +265,10 @@ function* handleEditorActivateFile( ); } + editor.pushUndoStop(); editor.setModel(file.model); editor.restoreViewState(file.viewState); + editor.pushUndoStop(); activeFileHistory.push(action.uuid); editor.focus();