Skip to content
Snippets Groups Projects

add vi keybindings in tui

Closed iyefrat requested to merge iyefrat/ghcup-hs:vi-keys into master
2 files
+ 6
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 5
1
@@ -122,7 +122,7 @@ ui AppState { appData = AppData {..}, appSettings = as@(AppSettings {..}), ..}
. txtWrap
. T.pack
. foldr1 (\x y -> x <> " " <> y)
. (++ ["↑↓:Navigation"])
. (++ ["↑↓/kj:Navigation"])
$ (fmap (\(c, s, _) -> (c : ':' : s as)) keyHandlers)
header =
(minHSize 2 $ emptyWidget)
@@ -269,6 +269,10 @@ eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KUp) _)) =
continue (AppState { appState = (moveCursor appState Up), .. })
eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KDown) _)) =
continue (AppState { appState = (moveCursor appState Down), .. })
eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KChar 'k') _)) =
continue (AppState { appState = (moveCursor appState Up), .. })
eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KChar 'j') _)) =
continue (AppState { appState = (moveCursor appState Down), .. })
eventHandler as (VtyEvent (Vty.EvKey (Vty.KChar c) _)) =
case find (\(c', _, _) -> c' == c) keyHandlers of
Nothing -> continue as
Loading