From 33cc87e1c4e45e1d42e8308e5d0350b37f596124 Mon Sep 17 00:00:00 2001 From: rebornix Date: Tue, 30 Mar 2021 08:41:55 -0700 Subject: [PATCH] re #118108. separate selection and focus. --- .../contrib/notebook/browser/notebookEditorWidget.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index 3b282d03b10..6c36ac2d323 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -963,9 +963,14 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor // todo@rebornix https://github.com/microsoft/vscode/issues/118108 support selections not just focus // todo@rebornix support multipe selections if (options?.cellSelections && this.viewModel) { - const focusedCell = this.viewModel.viewCells[options.cellSelections[0].start]; + const focusCellIndex = options.cellSelections[0].start; + const focusedCell = this.viewModel.viewCells[focusCellIndex]; + this.viewModel.updateSelectionsState({ + kind: SelectionStateType.Index, + focus: { start: focusCellIndex, end: focusCellIndex + 1 }, + selections: options.cellSelections + }); this.revealInCenterIfOutsideViewport(focusedCell); - this.focusElement(focusedCell); } }