fix #119205.
This commit is contained in:
parent
ca980ecfac
commit
f1c4a8676e
4 changed files with 15 additions and 2 deletions
|
@ -362,6 +362,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
|||
updateOptions(options: IListViewOptionsUpdate) {
|
||||
if (options.additionalScrollHeight !== undefined) {
|
||||
this.additionalScrollHeight = options.additionalScrollHeight;
|
||||
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
|
||||
}
|
||||
|
||||
if (options.smoothScrolling !== undefined) {
|
||||
|
|
|
@ -694,6 +694,7 @@ export interface INotebookCellList {
|
|||
domFocus(): void;
|
||||
setCellSelection(element: ICellViewModel, range: Range): void;
|
||||
style(styles: IListStyles): void;
|
||||
getRenderHeight(): number;
|
||||
updateOptions(options: IListOptions<ICellViewModel>): void;
|
||||
layout(height?: number, width?: number): void;
|
||||
dispose(): void;
|
||||
|
|
|
@ -1428,8 +1428,15 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
|
|||
|
||||
this._dimension = new DOM.Dimension(dimension.width, dimension.height);
|
||||
DOM.size(this._body, dimension.width, dimension.height - (this._useGlobalToolbar ? /** Toolbar height */ 26 : 0));
|
||||
this._list.updateOptions({ additionalScrollHeight: this._scrollBeyondLastLine ? dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP : SCROLLABLE_ELEMENT_PADDING_TOP });
|
||||
this._list.layout(dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP, dimension.width);
|
||||
if (this._list.getRenderHeight() < dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP) {
|
||||
// the new dimension is larger than the list viewport, update its additional height first, otherwise the list view will move down a bit (as the `scrollBottom` will move down)
|
||||
this._list.updateOptions({ additionalScrollHeight: this._scrollBeyondLastLine ? Math.max(0, (dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP - 50)) : SCROLLABLE_ELEMENT_PADDING_TOP });
|
||||
this._list.layout(dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP, dimension.width);
|
||||
} else {
|
||||
// the new dimension is smaller than the list viewport, if we update the additional height, the `scrollBottom` will move up, which moves the whole list view upwards a bit. So we run a layout first.
|
||||
this._list.layout(dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP, dimension.width);
|
||||
this._list.updateOptions({ additionalScrollHeight: this._scrollBeyondLastLine ? Math.max(0, (dimension.height - SCROLLABLE_ELEMENT_PADDING_TOP - 50)) : SCROLLABLE_ELEMENT_PADDING_TOP });
|
||||
}
|
||||
|
||||
this._overlayContainer.style.visibility = 'visible';
|
||||
this._overlayContainer.style.display = 'block';
|
||||
|
|
|
@ -1246,6 +1246,10 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
}
|
||||
}
|
||||
|
||||
getRenderHeight() {
|
||||
return this.view.renderHeight;
|
||||
}
|
||||
|
||||
layout(height?: number, width?: number): void {
|
||||
this._isInLayout = true;
|
||||
super.layout(height, width);
|
||||
|
|
Loading…
Reference in a new issue