forked from Mirrors/bubbletea
fix: use more bulletproof GetFrameSize() list examples
This commit is contained in:
parent
f80f0b1003
commit
442b8cde78
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue