Skip to content

Commit

Permalink
Trigger notebook list rerender when whitespace is dismissed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Mar 5, 2024
1 parent e3e0fe0 commit c0300af
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,20 @@ export class NotebookCellListView<T> extends ListView<T> {
}

removeWhitespace(id: string): void {
this.notebookRangeMap.removeWhitespace(id);
this.eventuallyUpdateScrollDimensions();
const scrollTop = this.scrollTop;
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
const currentPosition = this.notebookRangeMap.getWhitespacePosition(id);

if (currentPosition > scrollTop) {
this.notebookRangeMap.removeWhitespace(id);
this.render(previousRenderRange, scrollTop, this.lastRenderHeight, undefined, undefined, false);
this._rerender(scrollTop, this.renderHeight, false);
this.eventuallyUpdateScrollDimensions();
} else {
this.notebookRangeMap.removeWhitespace(id);
this.eventuallyUpdateScrollDimensions();
}

}

getWhitespacePosition(id: string): number {
Expand Down

0 comments on commit c0300af

Please sign in to comment.