mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-09 00:05:28 +01:00
fix #129552
This commit is contained in:
@@ -22,7 +22,7 @@ import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { getSimpleCodeEditorWidgetOptions, getSimpleEditorOptions } from 'vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
||||
import { InteractiveEditorInput } from 'vs/workbench/contrib/interactive/browser/interactiveEditorInput';
|
||||
import { IActiveNotebookEditorDelegate, ICellViewModel, INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CodeCellLayoutChangeEvent, IActiveNotebookEditorDelegate, ICellViewModel, INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { NotebookEditorExtensionsRegistry } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
||||
import { IBorrowValue, INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/notebookEditorService';
|
||||
import { cellEditorBackground, NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
||||
@@ -43,6 +43,7 @@ import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { createActionViewItem, createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
|
||||
|
||||
const DECORATION_KEY = 'interactiveInputDecoration';
|
||||
|
||||
@@ -399,7 +400,7 @@ export class InteractiveEditor extends EditorPane {
|
||||
* - receive a scroll event (scroll even already happened). If the last cell is at bottom, false, 0, true, state 1
|
||||
* - height change of the last cell, if state 0, do nothing, if state 1, scroll the last cell fully into view
|
||||
*/
|
||||
#registerExecutionScrollListener(widget: IActiveNotebookEditorDelegate) {
|
||||
#registerExecutionScrollListener(widget: NotebookEditorWidget & IActiveNotebookEditorDelegate) {
|
||||
this.#widgetDisposableStore.add(widget.textModel.onWillAddRemoveCells(e => {
|
||||
const lastViewCell = widget.cellAt(widget.getLength() - 1);
|
||||
|
||||
@@ -449,6 +450,10 @@ export class InteractiveEditor extends EditorPane {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.#lastCell instanceof CodeCellViewModel && (e as CodeCellLayoutChangeEvent).outputHeight === undefined && !this.#notebookWidget.value!.isScrolledToBottom()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.#state !== ScrollingState.StickyToBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,10 @@ export class ListViewInfoAccessor extends Disposable {
|
||||
this.list.scrollTop = scrollTop;
|
||||
}
|
||||
|
||||
isScrolledToBottom() {
|
||||
return this.list.isScrolledToBottom();
|
||||
}
|
||||
|
||||
scrollToBottom() {
|
||||
this.list.scrollToBottom();
|
||||
}
|
||||
@@ -1779,6 +1783,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
|
||||
});
|
||||
}
|
||||
|
||||
isScrolledToBottom() {
|
||||
return this._listViewInfoAccessor.isScrolledToBottom();
|
||||
}
|
||||
|
||||
scrollToBottom() {
|
||||
this._listViewInfoAccessor.scrollToBottom();
|
||||
}
|
||||
|
||||
@@ -736,6 +736,22 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
||||
this._revealInView(startIndex);
|
||||
}
|
||||
|
||||
isScrolledToBottom() {
|
||||
if (this.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const last = this.length - 1;
|
||||
const bottom = this.view.elementHeight(last) + this.view.elementTop(last);
|
||||
const wrapperBottom = this.getViewScrollTop() + this.view.renderHeight;
|
||||
|
||||
if (bottom <= wrapperBottom) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
scrollToBottom() {
|
||||
const scrollHeight = this.view.scrollHeight;
|
||||
const scrollTop = this.getViewScrollTop();
|
||||
|
||||
@@ -60,6 +60,7 @@ export interface INotebookCellList {
|
||||
getFocusedElements(): ICellViewModel[];
|
||||
getSelectedElements(): ICellViewModel[];
|
||||
revealElementsInView(range: ICellRange): void;
|
||||
isScrolledToBottom(): boolean;
|
||||
scrollToBottom(): void;
|
||||
revealElementInView(element: ICellViewModel): void;
|
||||
revealElementInViewAtTop(element: ICellViewModel): void;
|
||||
|
||||
Reference in New Issue
Block a user