fix: use more bulletproof GetFrameSize() list examples

This commit is contained in:
Christian Rocha 2022-03-17 16:13:32 -04:00
parent f80f0b1003
commit 442b8cde78
2 changed files with 4 additions and 4 deletions

View File

@ -34,8 +34,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit return m, tea.Quit
} }
case tea.WindowSizeMsg: case tea.WindowSizeMsg:
top, right, bottom, left := docStyle.GetMargin() h, v := docStyle.GetFrameSize()
m.list.SetSize(msg.Width-left-right, msg.Height-top-bottom) m.list.SetSize(msg.Width-h, msg.Height-v)
} }
var cmd tea.Cmd var cmd tea.Cmd

View File

@ -126,8 +126,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) { switch msg := msg.(type) {
case tea.WindowSizeMsg: case tea.WindowSizeMsg:
topGap, rightGap, bottomGap, leftGap := appStyle.GetPadding() h, v := appStyle.GetFrameSize()
m.list.SetSize(msg.Width-leftGap-rightGap, msg.Height-topGap-bottomGap) m.list.SetSize(msg.Width-h, msg.Height-v)
case tea.KeyMsg: case tea.KeyMsg:
// Don't match any of the keys below if we're actively filtering. // Don't match any of the keys below if we're actively filtering.