mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-29 10:54:48 +03:00
EventTrigger: Static -> ByKey
This commit is contained in:
parent
456da00fa9
commit
63a4083391
@ -110,8 +110,8 @@ keyHandlersFromConfig kc eh =
|
||||
| Just Unbound <- lookupKeyConfigBindings kc ev = []
|
||||
| otherwise = allDefaultBindings kc ev
|
||||
bindings = case kehEventTrigger eh of
|
||||
Static binding -> [binding]
|
||||
ByEvent ev -> allBindingsFor ev
|
||||
ByKey binding -> [binding]
|
||||
ByEvent ev -> allBindingsFor ev
|
||||
in [ KH { khHandler = eh, khKey = b } | b <- bindings ]
|
||||
|
||||
mkHandler :: T.Text -> m () -> Handler m
|
||||
@ -144,12 +144,12 @@ onKey :: (ToBinding a)
|
||||
-> KeyEventHandler e m
|
||||
onKey b msg action =
|
||||
KEH { kehHandler = mkHandler msg action
|
||||
, kehEventTrigger = Static $ toBinding b
|
||||
, kehEventTrigger = ByKey $ toBinding b
|
||||
}
|
||||
|
||||
-- | A trigger for an event handler.
|
||||
data EventTrigger e =
|
||||
Static Binding
|
||||
ByKey Binding
|
||||
-- ^ The key event is always triggered by a specific key.
|
||||
| ByEvent e
|
||||
-- ^ The trigger is an abstract key event.
|
||||
|
@ -88,7 +88,8 @@ mkKeybindEventHelp kc h =
|
||||
let trig = kehEventTrigger h
|
||||
unbound = [Comment "(unbound)"]
|
||||
(label, evText) = case trig of
|
||||
Static binding -> (Comment "(non-customizable key)", [Verbatim $ ppBinding binding])
|
||||
ByKey binding ->
|
||||
(Comment "(non-customizable key)", [Verbatim $ ppBinding binding])
|
||||
ByEvent ev ->
|
||||
let name = fromJust $ keyEventName (keyConfigEvents kc) ev
|
||||
in case lookupKeyConfigBindings kc ev of
|
||||
|
Loading…
Reference in New Issue
Block a user