HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulebrick-2.10Haskell2010

Brick.Keybindings.Parse

This module provides key binding string parsing functions for use in e.g. reading key bindings from configuration files.

  • 6 values
  • Packagebrick-2.10
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceParse.hs

Parse a key binding string. Key binding strings specify zero or more modifier keys and a base key, separated by hyphens.

(modifier "-")* key

e.g. c-down, backspace, ctrl-shift-f1.

where each modifier is parsed case-insensitively as follows:

and key is parsed case-insensitively as follows:

valuenormalizeKey :: [Modifier] -> Key -> Key
#

A keybinding involving modifiers should have its key character normalized to lowercase since it's impossible to get uppercase keys from the terminal when modifiers are present.

valuekeybindingsFromIni
  1. :: KeyEvents k

    The key event name mapping to use to parse the configuration data.

  2. -> Text

    The name of the INI configuration section to read.

  3. -> Text

    The text of the INI document to read.

  4. -> Either String (Maybe [(k, BindingState)])
#

Parse custom key bindings from the specified INI file using the provided event name mapping.

Each line in the specified section can take the form

<event-name> = <"unbound"|[binding,...]>

where the event name must be a valid event name in the specified KeyEvents and each binding is valid as parsed by parseBinding.

Returns Nothing if the named section was not found; otherwise returns a (possibly empty) list of binding states for each event in evs.