Add window padding to scrollView document height

pull/9241/head
Daniel Wennberg 2025-10-17 00:06:00 -07:00
parent ffead466c7
commit 51b2374616
1 changed files with 9 additions and 3 deletions

View File

@ -226,11 +226,17 @@ class SurfaceScrollView: NSView {
// Convert row units to pixels using cell height, ignore zero height.
let cellHeight = surfaceView.cellSize.height
guard cellHeight > 0 else { return }
// The full document height must include the vertical padding around the cell
// grid, otherwise the content view ends up misaligned with the surface.
let documentGridHeight = CGFloat(scrollbar.total) * cellHeight
let gridHeight = CGFloat(scrollbar.len) * cellHeight
let padding = scrollView.contentSize.height - gridHeight
let documentHeight = documentGridHeight + padding
// Our width should be the content width to account for visible scrollers.
// We don't do horizontal scrolling in terminals.
let totalHeight = CGFloat(scrollbar.total) * cellHeight
let newSize = CGSize(width: scrollView.contentSize.width, height: totalHeight)
let newSize = CGSize(width: scrollView.contentSize.width, height: documentHeight)
documentView.setFrameSize(newSize)
// Only update our actual scroll position if we're not actively scrolling.