Skip to content
Myr

Fix a performance rendering size miscalculation in the pager example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent d1fb02c · Browse files · 3 files+9 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−4 removed

  • other:+9 added−4 removed

3 files+9 added−4 removed

modified:examples/pager/main.go+6 added-1 removed
99 unmodified lines
100 // can initialize the viewport. The initial dimensions come in101 // quickly, though asynchronously, which is why we wait for them102 // here.103 m.viewport = viewport.Model{Width: msg.Width, Height: msg.Height - verticalMargins}104 m.viewport.YPosition = headerHeight104 m.viewport.HighPerformanceRendering = useHighPerformanceRenderer105 m.viewport.SetContent(m.content)106 m.ready = true107108 // This is only necessary for high performance rendering, which in109 // most cases you won't need.110 //111 // Render the viewport one line below the header.112 m.viewport.YPosition = headerHeight + 1113 } else {114 m.viewport.Width = msg.Width115 m.viewport.Height = msg.Height - verticalMargins116 }
46 unmodified lines
modified:examples/go.mod+1 added-1 removed
1 unmodified line
23go 1.1345require (6 github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e256 github.com/charmbracelet/bubbles v0.9.1-0.20210917202525-0ac5ecdf81707 github.com/charmbracelet/bubbletea v0.14.18 github.com/charmbracelet/glamour v0.2.09 github.com/charmbracelet/lipgloss v0.3.010 github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776
9 unmodified lines
modified:examples/go.sum+2 added-2 removed
7 unmodified lines
8github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=9github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=10github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=11github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=12github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e25 h1:iivPooBtdJV/i//6Zktuvr6CnF11xKp9H+Poy497PqY=13github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e25/go.mod h1:NWT/c+0rYEnYChz5qCyX4Lj6fDw9gGToh9EFJPajghU=12github.com/charmbracelet/bubbles v0.9.1-0.20210917202525-0ac5ecdf8170 h1:6gFVr0CeUQ4JHScJlBY/jeflgN70PLZ/gqG6st99tdo=13github.com/charmbracelet/bubbles v0.9.1-0.20210917202525-0ac5ecdf8170/go.mod h1:NWT/c+0rYEnYChz5qCyX4Lj6fDw9gGToh9EFJPajghU=14github.com/charmbracelet/glamour v0.2.0 h1:mTgaiNiumpqTZp3qVM6DH9UB0NlbY17wejoMf1kM8Pg=15github.com/charmbracelet/glamour v0.2.0/go.mod h1:UA27Kwj3QHialP74iU6C+Gpc8Y7IOAKupeKMLLBURWM=16github.com/charmbracelet/harmonica v0.1.0 h1:lFKeSd6OAckQ/CEzPVd2mqj+YMEubQ/3FM2IYY3xNm0=17github.com/charmbracelet/harmonica v0.1.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
74 unmodified lines