Skip to content

Commit

Permalink
fix #117792.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Feb 26, 2021
1 parent fc7005d commit e590188
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,25 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
}

focusNext(n: number | undefined, loop: boolean | undefined, browserEvent?: UIEvent, filter?: (element: CellViewModel) => boolean): void {
this._focusNextPreviousDelegate.onFocusNext(() => super.focusNext(n, loop, browserEvent, filter));
this._focusNextPreviousDelegate.onFocusNext(() => {
super.focusNext(n, loop, browserEvent, filter);
const focus = this.getFocus();
if (focus.length) {
const focusedElementHandle = this.element(focus[0]).handle;
this._viewModel?.updateSelectionsFromView(focusedElementHandle, [focusedElementHandle]);
}
});
}

focusPrevious(n: number | undefined, loop: boolean | undefined, browserEvent?: UIEvent, filter?: (element: CellViewModel) => boolean): void {
this._focusNextPreviousDelegate.onFocusPrevious(() => super.focusPrevious(n, loop, browserEvent, filter));
this._focusNextPreviousDelegate.onFocusPrevious(() => {
super.focusPrevious(n, loop, browserEvent, filter);
const focus = this.getFocus();
if (focus.length) {
const focusedElementHandle = this.element(focus[0]).handle;
this._viewModel?.updateSelectionsFromView(focusedElementHandle, [focusedElementHandle]);
}
});
}

setFocus(indexes: number[], browserEvent?: UIEvent, ignoreTextModelUpdate?: boolean): void {
Expand Down

0 comments on commit e590188

Please sign in to comment.