fix(dialog): commands: execute command handlers properly
commitc74a5c4d64491606fbeff0eda109b7eae5e4e52c
authorAyman Bagabas <ayman.bagabas@gmail.com>
dateTue 16 Dec 2025, 12:55 (1 year ago)
parent7fad242
internal/ui/dialog/commands.go+5−1
@@ -149,7 +149,11 @@ func (c *Commands) Update(msg tea.Msg) tea.Msg {
149149 case key.Matches(msg, c.keyMap.Select):
150150 if selectedItem := c.list.SelectedItem(); selectedItem != nil {
151151 if item, ok := selectedItem.(*CommandItem); ok && item != nil {
152− return item.Cmd.Handler(item.Cmd) // Huh??
152+ // TODO: Please unravel this mess later and the Command
153+ // Handler design.
154+ if cmd := item.Cmd.Handler(item.Cmd); cmd != nil { // Huh??
155+ return cmd()
156+ }
153157 }
154158 }
155159 case key.Matches(msg, c.keyMap.Tab):
internal/ui/model/ui.go+1
@@ -441,6 +441,7 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) (cmds []tea.Cmd) {
441441 }
442442 case dialog.ToggleHelpMsg:
443443 m.help.ShowAll = !m.help.ShowAll
444+ m.dialog.RemoveDialog(dialog.CommandsID)
444445 case dialog.QuitMsg:
445446 cmds = append(cmds, tea.Quit)
446447 }