Skip to content

Commit

Permalink
feat #193: Support hjkl navigation in TUI modals
Browse files Browse the repository at this point in the history
  • Loading branch information
F1bonacc1 committed Aug 9, 2024
1 parent e207158 commit 9daea44
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ func (pv *pcView) terminateAppView() {
pv.pages.SwitchToPage(PageMain)
pv.pages.RemovePage(PageDialog)
})
m.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
switch e.Rune() {
case 'h':
return tcell.NewEventKey(tcell.KeyLeft, e.Rune(), e.Modifiers())
case 'l':
return tcell.NewEventKey(tcell.KeyRight, e.Rune(), e.Modifiers())
case 'j':
return tcell.NewEventKey(tcell.KeyDown, e.Rune(), e.Modifiers())
case 'k':
return tcell.NewEventKey(tcell.KeyUp, e.Rune(), e.Modifiers())
}

return e
})
// Display and focus the dialog
pv.pages.AddPage(PageDialog, createDialogPage(m, 50, 50), true, true)
}
Expand Down

0 comments on commit 9daea44

Please sign in to comment.