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))
|
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().
|
return m.Style.Copy().
|
||||||
UnsetWidth().
|
Width(m.Width - m.Style.GetHorizontalFrameSize()).
|
||||||
UnsetHeight().
|
Height(m.Height - m.Style.GetVerticalFrameSize()).
|
||||||
Render(strings.Join(lines, "\n") + extraLines)
|
Render(strings.Join(m.visibleLines(), "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func clamp(v, low, high int) int {
|
func clamp(v, low, high int) int {
|
||||||
|
Loading…
Reference in New Issue
Block a user