diff --git a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts index 2e7c3b805f8..f54d78ac851 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts @@ -838,8 +838,8 @@ export class NotebookCellList extends WorkbenchList implements ID const firstIndex = this.view.firstVisibleIndex; const elementHeight = this.view.elementHeight(viewIndex); - if (viewIndex <= firstIndex || elementHeight >= this.view.renderHeight) { - this._revealInternal(viewIndex, true, CellRevealPosition.Top, firstLine); + if (viewIndex <= firstIndex || (!firstLine && elementHeight >= this.view.renderHeight)) { + this._revealInternal(viewIndex, true, CellRevealPosition.Top); } else { this._revealInternal(viewIndex, true, CellRevealPosition.Bottom, firstLine); }