From ecd3fe79d7aef7f3fa63ada31eaef181cbbfb3ec Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 10 Jun 2024 13:35:58 +0100 Subject: [PATCH] Allow quit from anywhere --- sevenkeys/tui/home.go | 7 +++++-- sevenkeys/tui/updateui/updateui.go | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sevenkeys/tui/home.go b/sevenkeys/tui/home.go index 46a7527..f612984 100644 --- a/sevenkeys/tui/home.go +++ b/sevenkeys/tui/home.go @@ -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 } diff --git a/sevenkeys/tui/updateui/updateui.go b/sevenkeys/tui/updateui/updateui.go index 6928478..dc86115 100644 --- a/sevenkeys/tui/updateui/updateui.go +++ b/sevenkeys/tui/updateui/updateui.go @@ -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