mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-12-01 17:32:52 +03:00
EventTrigger: Static -> ByKey
This commit is contained in:
parent
456da00fa9
commit
63a4083391
@ -110,7 +110,7 @@ keyHandlersFromConfig kc eh =
|
||||
| Just Unbound <- lookupKeyConfigBindings kc ev = []
|
||||
| otherwise = allDefaultBindings kc ev
|
||||
bindings = case kehEventTrigger eh of
|
||||
Static binding -> [binding]
|
||||
ByKey binding -> [binding]
|
||||
ByEvent ev -> allBindingsFor ev
|
||||
in [ KH { khHandler = eh, khKey = b } | b <- bindings ]
|
||||
|
||||
@ -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