package ui import ( "github.com/ayn2op/discordo/internal/config" "github.com/ayn2op/tview" "github.com/ayn2op/tview/keybind" "github.com/ayn2op/tview/list" ) // SelectionKeybind binds kbs to moving a list's selection. func SelectionKeybind(kbs config.SelectionKeybinds) func(tview.KeyMsg) list.Action { return func(key tview.KeyMsg) list.Action { switch { case keybind.Matches(key, kbs.SelectUp.Keybind): return list.ActionSelectUp case keybind.Matches(key, kbs.SelectDown.Keybind): return list.ActionSelectDown case keybind.Matches(key, kbs.SelectTop.Keybind): return list.ActionSelectTop case keybind.Matches(key, kbs.SelectBottom.Keybind): return list.ActionSelectBottom } return list.ActionNone } }