From f5eb98d5ae2cbba7eefe80c3893df733db092a92 Mon Sep 17 00:00:00 2001 From: rebornix Date: Tue, 31 Mar 2020 16:33:34 -0700 Subject: [PATCH] Fix ##93920. index in range. --- .../workbench/contrib/notebook/browser/notebookEditor.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index c0378bad9f4..5cc2f6a90ff 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -611,12 +611,20 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { async moveCellDown(cell: ICellViewModel): Promise { const index = this.notebookViewModel!.getViewCellIndex(cell); + if (index === this.notebookViewModel!.viewCells.length - 1) { + return; + } + const newIdx = index + 1; return this.moveCellToIndex(index, newIdx); } async moveCellUp(cell: ICellViewModel): Promise { const index = this.notebookViewModel!.getViewCellIndex(cell); + if (index === 0) { + return; + } + const newIdx = index - 1; return this.moveCellToIndex(index, newIdx); } -- GitLab