mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
fix #119205.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user