Refactor the keybinding stuff + add backspace

This commit is contained in:
Christian Rocha
2020-01-17 20:46:34 -05:00
parent 051a370769
commit 208f421470
4 changed files with 108 additions and 41 deletions

View File

@@ -22,14 +22,14 @@ func main() {
}
}
func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
func update(message tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
m, _ := mdl.(model)
switch message := msg.(type) {
switch msg := message.(type) {
case tea.KeyPressMsg:
switch message {
case "ctrl+c":
case tea.KeyMsg:
switch msg.String() {
case "break":
fallthrough
case "esc":
fallthrough