mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-01-11 14:38:10 +03:00
fix(viewport): honor width and height settings
This commit is contained in:
parent
776062e30c
commit
d44e242f37
@ -350,18 +350,10 @@ func (m Model) View() string {
|
||||
return strings.Repeat("\n", max(0, m.Height-1))
|
||||
}
|
||||
|
||||
lines := m.visibleLines()
|
||||
|
||||
// Fill empty space with newlines
|
||||
extraLines := ""
|
||||
if len(lines) < m.Height {
|
||||
extraLines = strings.Repeat("\n", max(0, m.Height-len(lines)))
|
||||
}
|
||||
|
||||
return m.Style.Copy().
|
||||
UnsetWidth().
|
||||
UnsetHeight().
|
||||
Render(strings.Join(lines, "\n") + extraLines)
|
||||
Width(m.Width - m.Style.GetHorizontalFrameSize()).
|
||||
Height(m.Height - m.Style.GetVerticalFrameSize()).
|
||||
Render(strings.Join(m.visibleLines(), "\n"))
|
||||
}
|
||||
|
||||
func clamp(v, low, high int) int {
|
||||
|
Loading…
Reference in New Issue
Block a user