brick-1.4: A declarative terminal user interface library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Brick.Keybindings.KeyEvents

Description

This module provides KeyEvents, a data type for mapping application-defined abstract events to user-facing names (e.g. for use in configuration files and documentation). This data structure gives you a place to define the correspondence between your application's key events and their names. A KeyEvents also effectively tells the key binding system about the collection of possible abstract events that can be handled.

A KeyEvents is used to construct a KeyConfig with newKeyConfig.

Synopsis

Documentation

data KeyEvents k Source #

A bidirectional mapping between events k and their user-readable names.

Instances

Instances details
Show k => Show (KeyEvents k) Source # 
Instance details

Defined in Brick.Keybindings.KeyEvents

Eq k => Eq (KeyEvents k) Source # 
Instance details

Defined in Brick.Keybindings.KeyEvents

Methods

(==) :: KeyEvents k -> KeyEvents k -> Bool #

(/=) :: KeyEvents k -> KeyEvents k -> Bool #

keyEvents :: Ord k => [(Text, k)] -> KeyEvents k Source #

Build a new KeyEvents map from the specified list of events and names. Key event names are stored in lowercase.

Calls error if any events have the same name (ignoring case) or if multiple names map to the same event.

keyEventsList :: KeyEvents k -> [(Text, k)] Source #

Convert the KeyEvents to a list.

lookupKeyEvent :: Ord k => KeyEvents k -> Text -> Maybe k Source #

Look up the specified event name to get its abstract event. The lookup ignores leading and trailing whitespace as well as case.

keyEventName :: Ord k => KeyEvents k -> k -> Maybe Text Source #

Given an abstract event, get its event name.