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 <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2025-01-21 19:31:03 -03:00
committed by GitHub
parent e3ce11a65f
commit 7ab08fb438
+1 -1
View File
@@ -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