From 5e697b348c0336d11a64ce0440aed6c40b104f1c Mon Sep 17 00:00:00 2001 From: rebornix Date: Mon, 10 Aug 2020 13:30:53 -0700 Subject: [PATCH] fix #104397. --- .../contrib/notebook/browser/view/notebookCellList.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts index 687a666c773..6a257986a44 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts @@ -398,6 +398,10 @@ export class NotebookCellList extends WorkbenchList implements ID const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex); if (viewIndexInfo.remainder !== 0) { + if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) { + // it's already after the last hidden range + return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount()); + } return undefined; } else { return viewIndexInfo.index; @@ -413,6 +417,12 @@ export class NotebookCellList extends WorkbenchList implements ID const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex); + if (viewIndexInfo.remainder !== 0) { + if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) { + return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount()); + } + } + return viewIndexInfo.index; }