Fix a performance rendering size miscalculation in the pager example

This commit is contained in:
Christian Rocha
2021-09-17 16:31:31 -04:00
parent d1fb02c39d
commit 7396e37f3f
3 changed files with 9 additions and 4 deletions

View File

@@ -101,10 +101,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// quickly, though asynchronously, which is why we wait for them
// here.
m.viewport = viewport.Model{Width: msg.Width, Height: msg.Height - verticalMargins}
m.viewport.YPosition = headerHeight
m.viewport.HighPerformanceRendering = useHighPerformanceRenderer
m.viewport.SetContent(m.content)
m.ready = true
// This is only necessary for high performance rendering, which in
// most cases you won't need.
//
// Render the viewport one line below the header.
m.viewport.YPosition = headerHeight + 1
} else {
m.viewport.Width = msg.Width
m.viewport.Height = msg.Height - verticalMargins