License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Parsing and pretty-printing for keys (as in, keys on a keyboard) and key combos.
Synopsis
- data KeyCombo
- mkKeyCombo :: [Modifier] -> Key -> KeyCombo
- parseKeyComboFull :: Parser KeyCombo
- parseKeyCombo :: Parser KeyCombo
- prettyKeyCombo :: KeyCombo -> Text
- specialKeyNames :: Set Text
Documentation
A keyboard input, represented as a key + modifiers. Invariant: the modifier list is always sorted.
Instances
FromJSON KeyCombo Source # | |
ToJSON KeyCombo Source # | |
Defined in Swarm.Language.Key | |
Generic KeyCombo Source # | |
Show KeyCombo Source # | |
Eq KeyCombo Source # | |
Ord KeyCombo Source # | |
Defined in Swarm.Language.Key | |
type Rep KeyCombo Source # | |
Defined in Swarm.Language.Key type Rep KeyCombo = D1 ('MetaData "KeyCombo" "Swarm.Language.Key" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "KeyCombo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Key) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Modifier]))) |
parseKeyComboFull :: Parser KeyCombo Source #
Parse a key combo with nothing after it.
parseKeyCombo :: Parser KeyCombo Source #
Parse a key combo like "M-C-F5"
, "Down"
, or "C-x"
.
prettyKeyCombo :: KeyCombo -> Text Source #
Pretty-print a key combo, e.g. "C-M-F5"
. Right inverse to
parseKeyCombo
. Left inverse up to reordering of modifiers.