Skip to content
Myr

fix: use more bulletproof GetFrameSize() list examples

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 f80f0b1 · Browse files · 2 files+4 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

2 files+4 added−4 removed

  • other:+4 added−4 removed

2 files+4 added−4 removed

modified:examples/list-default/main.go+2 added-2 removed
32 unmodified lines
33 if msg.String() == "ctrl+c" {34 return m, tea.Quit35 }36 case tea.WindowSizeMsg:37 top, right, bottom, left := docStyle.GetMargin()38 m.list.SetSize(msg.Width-left-right, msg.Height-top-bottom)37 h, v := docStyle.GetFrameSize()38 m.list.SetSize(msg.Width-h, msg.Height-v)39 }4041 var cmd tea.Cmd42 m.list, cmd = m.list.Update(msg)
44 unmodified lines
modified:examples/list-fancy/main.go+2 added-2 removed
124 unmodified lines
125 var cmds []tea.Cmd126127 switch msg := msg.(type) {128 case tea.WindowSizeMsg:129 topGap, rightGap, bottomGap, leftGap := appStyle.GetPadding()130 m.list.SetSize(msg.Width-leftGap-rightGap, msg.Height-topGap-bottomGap)129 h, v := appStyle.GetFrameSize()130 m.list.SetSize(msg.Width-h, msg.Height-v)131132 case tea.KeyMsg:133 // Don't match any of the keys below if we're actively filtering.134 if m.list.FilterState() == list.Filtering {
56 unmodified lines