implemented arbitrary rung selection
This commit is contained in:
@@ -43,6 +43,7 @@ import Brick.Keybindings
|
||||
, shift
|
||||
)
|
||||
import Control.Monad.State.Class (modify)
|
||||
import Data.Char (chr, ord)
|
||||
import Data.Either (fromRight)
|
||||
import Graphics.Vty.Input.Events
|
||||
(Key (KUp, KDown, KLeft, KRight, KHome, KEnd))
|
||||
@@ -75,7 +76,11 @@ eventBindings =
|
||||
modify rungLeft
|
||||
, onEvent RungRightE "Moves all beads to the right of the rung" $
|
||||
modify rungRight
|
||||
]
|
||||
] ++ map
|
||||
( \n -> onEvent (SelRungE n) "Moves to a numbered rung" $
|
||||
modify $ selRung n
|
||||
)
|
||||
[0..9]
|
||||
|
||||
-- | Key bindings
|
||||
keyBindings :: [(KeyEventID, [Binding])]
|
||||
@@ -117,6 +122,12 @@ keyBindings =
|
||||
, bind 'L'
|
||||
]
|
||||
)
|
||||
]
|
||||
] ++ map
|
||||
( \n ->
|
||||
( SelRungE n
|
||||
, [bind $ chr $ ord '0' + n]
|
||||
)
|
||||
)
|
||||
[0..9]
|
||||
|
||||
--jl
|
||||
|
||||
Reference in New Issue
Block a user