add keymap, handle wrapper for common keybindings

This commit is contained in:
Bradley Cicenas
2017-03-14 22:34:09 +00:00
parent b3cdb33efc
commit 38599bbd19
4 changed files with 55 additions and 30 deletions

View File

@@ -81,11 +81,15 @@ func SortMenu() {
// set cursor position to current sort field
m.SetCursor(config.GetVal("sortField"))
ui.Render(m)
m.NavigationHandlers()
HandleKeys("up", m.Up)
HandleKeys("down", m.Down)
HandleKeys("exit", ui.StopLoop)
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
config.Update("sortField", m.SelectedItem().Val)
ui.StopLoop()
})
ui.Render(m)
ui.Loop()
}