Skip to content

Commit d44e242

Browse files
committed
fix(viewport): honor width and height settings
1 parent 776062e commit d44e242

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

viewport/viewport.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,10 @@ func (m Model) View() string {
350350
return strings.Repeat("\n", max(0, m.Height-1))
351351
}
352352

353-
lines := m.visibleLines()
354-
355-
// Fill empty space with newlines
356-
extraLines := ""
357-
if len(lines) < m.Height {
358-
extraLines = strings.Repeat("\n", max(0, m.Height-len(lines)))
359-
}
360-
361353
return m.Style.Copy().
362-
UnsetWidth().
363-
UnsetHeight().
364-
Render(strings.Join(lines, "\n") + extraLines)
354+
Width(m.Width - m.Style.GetHorizontalFrameSize()).
355+
Height(m.Height - m.Style.GetVerticalFrameSize()).
356+
Render(strings.Join(m.visibleLines(), "\n"))
365357
}
366358

367359
func clamp(v, low, high int) int {

0 commit comments

Comments
 (0)