diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts index 755322b8c55d04a5120486e737149330a036202b..0599f5cba35cd9dec880f414e974213eec0b6862 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts @@ -49,6 +49,11 @@ export class CodeCell extends Disposable { const lineHeight = this.viewCell.layoutInfo.fontInfo?.lineHeight || 17; const editorPadding = this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata); + // patch up focusMode + if (this.viewCell.focusMode === CellFocusMode.Editor && this.notebookEditor.getActiveCell() !== this.viewCell) { + this.viewCell.focusMode = CellFocusMode.Container; + } + const editorHeight = this.viewCell.layoutInfo.editorHeight === 0 ? lineNum * lineHeight + editorPadding.top + editorPadding.bottom : this.viewCell.layoutInfo.editorHeight; @@ -91,10 +96,6 @@ export class CodeCell extends Disposable { }); const updateForFocusMode = () => { - if (this.notebookEditor.getFocus().start !== this.notebookEditor.getCellIndex(viewCell)) { - templateData.container.classList.toggle('cell-editor-focus', viewCell.focusMode === CellFocusMode.Editor); - } - if (viewCell.focusMode === CellFocusMode.Editor && this.notebookEditor.getActiveCell() === this.viewCell) { templateData.editor?.focus(); }