Skip to content

Commit 7ab08fb

Browse files
authored
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 <[email protected]>
1 parent e3ce11a commit 7ab08fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

viewport/viewport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (m *Model) SetContent(s string) {
140140
// maxYOffset returns the maximum possible value of the y-offset based on the
141141
// viewport's content and set height.
142142
func (m Model) maxYOffset() int {
143-
return max(0, len(m.lines)-m.Height)
143+
return max(0, len(m.lines)-m.Height+m.Style.GetVerticalFrameSize())
144144
}
145145

146146
// visibleLines returns the lines that should currently be visible in the

0 commit comments

Comments
 (0)