mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
minimum scrolling to reveal the next cell on shift+enter (#183600)
do minimum scrolling to reveal the next cell on Execute cell and select next
This commit is contained in:
parent
354fb8fafa
commit
397175e067
|
@ -456,12 +456,12 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
|
|||
const nextCell = context.notebookEditor.cellAt(idx + 1);
|
||||
context.cell.updateEditState(CellEditState.Preview, EXECUTE_CELL_SELECT_BELOW);
|
||||
if (nextCell) {
|
||||
await context.notebookEditor.focusNotebookCell(nextCell, 'container');
|
||||
await context.notebookEditor.focusNotebookCell(nextCell, 'container', { minimalScrolling: true });
|
||||
} else {
|
||||
const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Markup, 'below');
|
||||
|
||||
if (newCell) {
|
||||
await context.notebookEditor.focusNotebookCell(newCell, 'editor');
|
||||
await context.notebookEditor.focusNotebookCell(newCell, 'editor', { minimalScrolling: true });
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -469,12 +469,12 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
|
|||
// Try to select below, fall back on inserting
|
||||
const nextCell = context.notebookEditor.cellAt(idx + 1);
|
||||
if (nextCell) {
|
||||
await context.notebookEditor.focusNotebookCell(nextCell, 'container');
|
||||
await context.notebookEditor.focusNotebookCell(nextCell, 'container', { minimalScrolling: true });
|
||||
} else {
|
||||
const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Code, 'below');
|
||||
|
||||
if (newCell) {
|
||||
await context.notebookEditor.focusNotebookCell(newCell, 'editor');
|
||||
await context.notebookEditor.focusNotebookCell(newCell, 'editor', { minimalScrolling: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ export interface ICommonCellInfo {
|
|||
export interface IFocusNotebookCellOptions {
|
||||
readonly skipReveal?: boolean;
|
||||
readonly focusEditorLine?: number;
|
||||
readonly minimalScrolling?: boolean;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
|
|
@ -2352,6 +2352,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
|
|||
if (typeof options?.focusEditorLine === 'number') {
|
||||
this._cursorNavMode.set(true);
|
||||
this.revealInView(cell);
|
||||
} else if (options?.minimalScrolling) {
|
||||
this.revealInView(cell);
|
||||
} else {
|
||||
this.revealInCenterIfOutsideViewport(cell);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue