implemented row selection
This commit is contained in:
@@ -42,8 +42,11 @@ import Brick.Keybindings
|
||||
, newKeyConfig
|
||||
, onEvent
|
||||
)
|
||||
import Control.Monad.State.Class (modify)
|
||||
import Data.Either (fromRight)
|
||||
import Graphics.Vty.Input.Events (Key (KUp, KDown))
|
||||
|
||||
import Abacus.App.Actions
|
||||
import Abacus.App.Types
|
||||
|
||||
-- | Application keyboard configuration
|
||||
@@ -57,7 +60,13 @@ keyConfig = newKeyConfig appKeyEvents keyBindings []
|
||||
|
||||
-- | Binds a "KeyEventID" to its associated action
|
||||
eventBindings :: [KeyEventHandler KeyEventID (EventM () AppState)]
|
||||
eventBindings = [onEvent QuitE "Quits the program" halt]
|
||||
eventBindings =
|
||||
[ onEvent QuitE "Quits the program" halt
|
||||
, onEvent MoveUpE "Moves the cursor up" $
|
||||
modify moveUp
|
||||
, onEvent MoveDownE "Moves the cursor down" $
|
||||
modify moveDown
|
||||
]
|
||||
|
||||
-- | Names the individual key events
|
||||
appKeyEvents :: KeyEvents KeyEventID
|
||||
@@ -71,6 +80,16 @@ keyBindings =
|
||||
, bind 'q'
|
||||
]
|
||||
)
|
||||
, ( MoveUpE
|
||||
, [ bind KUp
|
||||
, bind 'k'
|
||||
]
|
||||
)
|
||||
, ( MoveDownE
|
||||
, [ bind KDown
|
||||
, bind 'j'
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
--jl
|
||||
|
||||
Reference in New Issue
Block a user