23 lines
378 B
Go
23 lines
378 B
Go
|
package ui
|
||
|
|
||
|
import 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
|
||
|
return m, nil
|
||
|
case tea.KeyMsg:
|
||
|
switch msg.String() {
|
||
|
case "ctrl+c":
|
||
|
return m, tea.Quit
|
||
|
}
|
||
|
break
|
||
|
}
|
||
|
|
||
|
return m, cmd
|
||
|
}
|