From 616aea313f4f0d6d91b1ef76b3f71cb283f2da67 Mon Sep 17 00:00:00 2001 From: rebornix Date: Fri, 24 Sep 2021 15:06:16 -0700 Subject: [PATCH] re #132143. merge clear and append edits. --- .../contrib/notebook/common/model/notebookTextModel.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts index 428ff1a1a70..46432f7d77b 100644 --- a/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts +++ b/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts @@ -555,6 +555,15 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel && last.cellIndex === edit.cellIndex ) { last.edit.outputs = [...last.edit.outputs, ...edit.edit.outputs]; + } else if (last.edit.editType === CellEditType.Output + && !last.edit.append // last cell is not append + && last.edit.outputs.length === 0 // last cell is clear outputs + && edit.edit.editType === CellEditType.Output + && edit.edit.append + && last.cellIndex === edit.cellIndex + ) { + last.edit.append = false; + last.edit.outputs = edit.edit.outputs; } else { mergedEdits.push(edit); }