implemented arbitrary rung selection

This commit is contained in:
2024-08-22 18:50:27 -04:00
parent a3259f3b7d
commit 04e90481de
4 changed files with 37 additions and 2 deletions
+13 -2
View File
@@ -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