brick-2.1.1: A declarative terminal user interface library

Safe Haskell | Safe-Inferred
Language | Haskell2010

Brick.Keybindings.Pretty

Contents

- Generating help output
- Pretty-printing primitives
- Attributes for Widget rendering

Description

This module provides functions for pretty-printing key bindings and for generating Markdown, plain text, and Brick displays of event handler key binding configurations.

Synopsis

- keybindingTextTable :: Ord k => KeyConfig k -> [(Text, [KeyEventHandler k m])] -> Text
- keybindingMarkdownTable :: Ord k => KeyConfig k -> [(Text, [KeyEventHandler k m])] -> Text
- keybindingHelpWidget :: Ord k => KeyConfig k -> [KeyEventHandler k m] -> Widget n
- ppBinding :: Binding -> Text
- ppMaybeBinding :: Maybe Binding -> Text
- ppKey :: Key -> Text
- ppModifier :: Modifier -> Text
- keybindingHelpBaseAttr :: AttrName
- eventNameAttr :: AttrName
- eventDescriptionAttr :: AttrName
- keybindingAttr :: AttrName

# Generating help output

keybindingTextTable Source #

Arguments

:: Ord k |
=> KeyConfig k | The key binding configuration in use.
-> [(Text, [KeyEventHandler k m])] | Key event handlers by named section.
-> Text |

Generate a plain text document of sections indicating the key binding state for each event handler.

keybindingMarkdownTable Source #

Arguments

:: Ord k |
=> KeyConfig k | The key binding configuration in use.
-> [(Text, [KeyEventHandler k m])] | Key event handlers by named section.
-> Text |

Generate a Markdown document of sections indicating the key binding state for each event handler.

keybindingHelpWidget Source #

Arguments

:: Ord k |
=> KeyConfig k | The key binding configuration in use.
-> [KeyEventHandler k m] | The list of the event handlers to include in the help display.
-> Widget n |

Build a `Widget` displaying key binding information for a single related group of event handlers. This is provided for convenience so that basic help text for the application's event handlers can be produced and embedded in the UI.

The resulting widget lists the key events (and keys) bound to the specified handlers, along with the events' names and the list of available key bindings for each handler.

# Pretty-printing primitives

ppBinding :: Binding -> Text Source #

Pretty-print a `Binding` in the same format that is parsed by `parseBinding`.

ppMaybeBinding :: Maybe Binding -> Text Source #

Pretty-print a `Binding` in the same format that is parsed by `parseBinding`; if no binding is given, produce a message indicating no binding.

ppKey :: Key -> Text Source #

Pretty-print a `Key` in the same format that is parsed by `parseBinding`.

ppModifier :: Modifier -> Text Source #

Pretty-print a `Modifier` in the same format that is parsed by `parseBinding`.

# Attributes for Widget rendering

keybindingHelpBaseAttr :: AttrName Source #

The base attribute for `Widget` keybinding help.

eventNameAttr :: AttrName Source #

The attribute for event names in keybinding help `Widget`s.

eventDescriptionAttr :: AttrName Source #

The attribute for event descriptions in keybinding help `Widget`s.

keybindingAttr :: AttrName Source #

The attribute for keybinding lists in keybinding help `Widget`s.