mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-25 16:53:54 +00:00
Add window padding to scrollView document height
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user