From 7ab08fb438e4fa1f7968a00a345399de30d1684c Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 21 Jan 2025 19:31:03 -0300 Subject: [PATCH] fix(viewport): scroll to last line when borders (#706) If the viewport has borders, they are not currently taken into account when calculating the viewport max y offset, which might cause the last line to not be visible. This is easily reproducible in `gum pager`. Signed-off-by: Carlos Alexandro Becker --- viewport/viewport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewport/viewport.go b/viewport/viewport.go index 1835b8d..11c6da7 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -140,7 +140,7 @@ func (m *Model) SetContent(s string) { // maxYOffset returns the maximum possible value of the y-offset based on the // viewport's content and set height. func (m Model) maxYOffset() int { - return max(0, len(m.lines)-m.Height) + return max(0, len(m.lines)-m.Height+m.Style.GetVerticalFrameSize()) } // visibleLines returns the lines that should currently be visible in the