on main help sign in
fix(tui): prevent dialog keymaps from being swallowed (#782)
63e53f1Uri Gorelik
internal/tui/tui.go+12−13
@@ -372,6 +372,11 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
372 return cmd
372 return cmd
373 }
373 }
374 }
374 }
375+ if a.dialog.HasDialogs() {
376+ u, dialogCmd := a.dialog.Update(msg)
377+ a.dialog = u.(dialogs.DialogCmp)
378+ return dialogCmd
379+ }
375 switch {
380 switch {
376 // help
381 // help
377 case key.Matches(msg, a.keyMap.Help):
382 case key.Matches(msg, a.keyMap.Help):
@@ -432,20 +437,14 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
432 }
437 }
433 return tea.Suspend
438 return tea.Suspend
434 default:
439 default:
435− if a.dialog.HasDialogs() {
436− u, dialogCmd := a.dialog.Update(msg)
437− a.dialog = u.(dialogs.DialogCmp)
438− return dialogCmd
439− } else {
440− item, ok := a.pages[a.currentPage]
440+ item, ok := a.pages[a.currentPage]
441− if !ok {
441+ if !ok {
442− return nil
442+ return nil
443− }
444−
445− updated, cmd := item.Update(msg)
446− a.pages[a.currentPage] = updated.(util.Model)
447− return cmd
448 }
443 }
444+
445+ updated, cmd := item.Update(msg)
446+ a.pages[a.currentPage] = updated.(util.Model)
447+ return cmd
449 }
448 }
450}
449}
451
450