From a28244948f413b333ebd84315c68008eb78d658f Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Mon, 14 Jul 2025 11:34:21 +0200 Subject: [PATCH] chore: prevent multiple dialogs from opening --- internal/tui/tui.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 365db72299865897feb94879f837baa93bff5e43..0b10b74792c5cc6c91dc285d42a7d9a6736c2b90 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -315,7 +315,6 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { // dialogs case key.Matches(msg, a.keyMap.Quit): if a.dialog.ActiveDialogID() == quit.QuitDialogID { - // if the quit dialog is already open, close the app return tea.Quit } return util.CmdHandler(dialogs.OpenDialogMsg{ @@ -324,20 +323,21 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { case key.Matches(msg, a.keyMap.Commands): if a.dialog.ActiveDialogID() == commands.CommandsDialogID { - // If the commands dialog is already open, close it return util.CmdHandler(dialogs.CloseDialogMsg{}) } if a.dialog.HasDialogs() { - return nil // Don't open commands dialog if another dialog is active + return nil } return util.CmdHandler(dialogs.OpenDialogMsg{ Model: commands.NewCommandDialog(a.selectedSessionID), }) case key.Matches(msg, a.keyMap.Sessions): if a.dialog.ActiveDialogID() == sessions.SessionsDialogID { - // If the sessions dialog is already open, close it return util.CmdHandler(dialogs.CloseDialogMsg{}) } + if a.dialog.HasDialogs() && a.dialog.ActiveDialogID() != commands.CommandsDialogID { + return nil + } var cmds []tea.Cmd if a.dialog.ActiveDialogID() == commands.CommandsDialogID { // If the commands dialog is open, close it first