Allow quit from anywhere

This commit is contained in:
The Magician 2024-06-10 13:35:58 +01:00
parent d2fcce2d94
commit ecd3fe79d7
2 changed files with 5 additions and 4 deletions

View File

@ -141,6 +141,11 @@ func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
constants.WindowHeight = msg.Height
constants.WindowWidth = msg.Width
m.help.Width = msg.Width
case tea.KeyMsg:
switch {
case key.Matches(msg, m.keyMappings.Quit):
return m, tea.Quit
}
case updateui.BackMsg:
m.state = homeView
}
@ -156,8 +161,6 @@ func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case key.Matches(msg, m.keyMappings.Search):
m.state = searchView
break
case key.Matches(msg, m.keyMappings.Quit):
return m, tea.Quit
}
break
}

View File

@ -77,8 +77,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch {
case key.Matches(msg, m.keyMappings.back):
return m, backCmd()
case key.Matches(msg, m.keyMappings.quit):
return m, tea.Quit
}
}
break