From d9111772d941dc22d6725009df2438bf42f8ec19 Mon Sep 17 00:00:00 2001 From: rebornix Date: Fri, 21 Feb 2020 10:06:11 -0800 Subject: [PATCH] Focus editor when creating new cells --- .../contrib/notebook/browser/notebookEditor.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index a3b8331a68a..f14dbc13ac2 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -404,18 +404,10 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { } }; - if (this.list?.isRendering) { - // if (this.relayoutDisposable) { - // this.relayoutDisposable.dispose(); - // this.relayoutDisposable = null; - // } - DOM.scheduleAtNextAnimationFrame(() => { - relayout(cell, height); - // this.relayoutDisposable = null; - }); - } else { + DOM.scheduleAtNextAnimationFrame(() => { relayout(cell, height); - } + // this.relayoutDisposable = null; + }); } updateViewCells(splices: NotebookCellsSplice[]) { @@ -456,6 +448,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { this.viewCells!.splice(insertIndex, 0, newCell); this.model!.insertCell(newCell.cell, insertIndex); this.list?.splice(insertIndex, 0, [newCell]); + this.list?.setFocus([insertIndex]); if (type === 'markdown') { newCell.isEditing = true; -- GitLab