From 442b8cde782c0b89c845cdba7bd01cdb4af1306e Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 17 Mar 2022 16:13:32 -0400 Subject: [PATCH] fix: use more bulletproof GetFrameSize() list examples --- examples/list-default/main.go | 4 ++-- examples/list-fancy/main.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/list-default/main.go b/examples/list-default/main.go index e7b1d6b..5c5fcc8 100644 --- a/examples/list-default/main.go +++ b/examples/list-default/main.go @@ -34,8 +34,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Quit } case tea.WindowSizeMsg: - top, right, bottom, left := docStyle.GetMargin() - m.list.SetSize(msg.Width-left-right, msg.Height-top-bottom) + h, v := docStyle.GetFrameSize() + m.list.SetSize(msg.Width-h, msg.Height-v) } var cmd tea.Cmd diff --git a/examples/list-fancy/main.go b/examples/list-fancy/main.go index b3daa39..69617cb 100644 --- a/examples/list-fancy/main.go +++ b/examples/list-fancy/main.go @@ -126,8 +126,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.WindowSizeMsg: - topGap, rightGap, bottomGap, leftGap := appStyle.GetPadding() - m.list.SetSize(msg.Width-leftGap-rightGap, msg.Height-topGap-bottomGap) + h, v := appStyle.GetFrameSize() + m.list.SetSize(msg.Width-h, msg.Height-v) case tea.KeyMsg: // Don't match any of the keys below if we're actively filtering.