matterhorn-50200.11.0: Terminal client for the Mattermost chat system

Safe HaskellNone
LanguageHaskell2010

Matterhorn.Events.Keybindings

Synopsis

Documentation

lookupKeybinding :: Event -> KeyHandlerMap -> Maybe KeyHandler Source #

Find a keybinding that matches a Vty Event

handleKeyboardEvent Source #

Arguments

:: (KeyConfig -> KeyHandlerMap)

The function to build a key handler map from a key configuration.

-> (Event -> MH ())

The fallback action to invoke if no matching binding can be found.

-> Event

The event to handle.

-> MH Bool 

Handle a keyboard event by looking it up in a map of bindings and invoking the matching binding's handler. If no match can be found, invoke a fallback action instead. Return True if the key event was handled with a matching binding; False if not (the fallback case).

data EventHandler Source #

An EventHandler represents a event handler.

Constructors

EH 

Fields

data KeyHandler Source #

A handler for a specific key.

Constructors

KH 

Fields

data KeyEventHandler Source #

A handler for an abstract key event.

Constructors

KEH 

Fields

data KeyEventTrigger Source #

A trigger for a key event.

Constructors

Static Event

The key event is always triggered by a specific key.

ByEvent KeyEvent

The key event is always triggered by an abstract key event (and thus configured to be bound to specific key(s) in the KeyConfig).

data KeyEvent Source #

This enum represents all the possible key events a user might want to use.

ensureKeybindingConsistency :: KeyConfig -> [(String, KeyConfig -> KeyHandlerMap)] -> Either String () Source #

Given a configuration, we want to check it for internal consistency (i.e. that a given keybinding isn't associated with multiple events which both need to get generated in the same UI mode) and also for basic usability (i.e. we shouldn't be binding events which can appear in the main UI to a key like e, which would prevent us from being able to type messages containing an e in them!