27 lines
467 B
Go
27 lines
467 B
Go
|
package home
|
||
|
|
||
|
import (
|
||
|
"github.com/charmbracelet/bubbles/key"
|
||
|
tea "github.com/charmbracelet/bubbletea"
|
||
|
)
|
||
|
|
||
|
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||
|
var cmd tea.Cmd
|
||
|
|
||
|
switch msg := msg.(type) {
|
||
|
case tea.WindowSizeMsg:
|
||
|
m.WindowHeight = msg.Height
|
||
|
m.WindowWidth = msg.Width
|
||
|
m.Help.Width = msg.Width
|
||
|
return m, nil
|
||
|
case tea.KeyMsg:
|
||
|
switch {
|
||
|
case key.Matches(msg, DefaultKeyMap.Quit):
|
||
|
return m, tea.Quit
|
||
|
}
|
||
|
break
|
||
|
}
|
||
|
|
||
|
return m, cmd
|
||
|
}
|