From c74a5c4d64491606fbeff0eda109b7eae5e4e52c Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 16 Dec 2025 12:55:40 -0500 Subject: [PATCH] fix(dialog): commands: execute command handlers properly --- internal/ui/dialog/commands.go | 6 +++++- internal/ui/model/ui.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/ui/dialog/commands.go b/internal/ui/dialog/commands.go index f9667787430423e01ee0eab6be59bf8ce76f3b70..d6fbfa750f27e7b6641b543d417a5b4aa07c0bbc 100644 --- a/internal/ui/dialog/commands.go +++ b/internal/ui/dialog/commands.go @@ -149,7 +149,11 @@ func (c *Commands) Update(msg tea.Msg) tea.Msg { case key.Matches(msg, c.keyMap.Select): if selectedItem := c.list.SelectedItem(); selectedItem != nil { if item, ok := selectedItem.(*CommandItem); ok && item != nil { - return item.Cmd.Handler(item.Cmd) // Huh?? + // TODO: Please unravel this mess later and the Command + // Handler design. + if cmd := item.Cmd.Handler(item.Cmd); cmd != nil { // Huh?? + return cmd() + } } } case key.Matches(msg, c.keyMap.Tab): diff --git a/internal/ui/model/ui.go b/internal/ui/model/ui.go index 2755410947ac41e62951c42c11e514c40727abce..fac8ccd7f1813c1f839a34bee28c6bfcd6bdc0b0 100644 --- a/internal/ui/model/ui.go +++ b/internal/ui/model/ui.go @@ -441,6 +441,7 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) (cmds []tea.Cmd) { } case dialog.ToggleHelpMsg: m.help.ShowAll = !m.help.ShowAll + m.dialog.RemoveDialog(dialog.CommandsID) case dialog.QuitMsg: cmds = append(cmds, tea.Quit) }