WEditorBrick-0.2.0.0: Text-editor widget with dynamic line-wrapping for use with Brick.

Safe HaskellTrustworthy
LanguageHaskell2010

WEditorBrick.WrappingEditor

Description

A wrapping text-editor with dynamic sizing for Brick.

Synopsis

Documentation

data WrappingEditor c n Source #

Editor widget for use with Brick.

Instances
Show n => Show (WrappingEditor c n) Source # 
Instance details

Defined in WEditorBrick.WrappingEditor

Named (WrappingEditor c n) n Source # 
Instance details

Defined in WEditorBrick.WrappingEditor

Methods

getName :: WrappingEditor c n -> n #

type WrappingEditorAction c = forall a. (FixedFontViewer a c, FixedFontEditor a c) => a -> a Source #

Any action that updates the editor state.

type WrappingEditorDoer c b = forall a. (FixedFontViewer a c, FixedFontEditor a c) => a -> b Source #

Any action that reads the editor state.

doEditor :: WrappingEditorDoer c b -> WrappingEditor c n -> b Source #

Read from the editor state.

dumpEditor :: WrappingEditor c n -> [[c]] Source #

Dump the final contents of the edited document.

genericEditor :: (FixedFontViewer a c, FixedFontEditor a c) => n -> a -> WrappingEditor c n Source #

Create a new WrappingEditor using a custom editor component.

handleEditor :: Eq n => WrappingEditor Char n -> Event -> EventM n (WrappingEditor Char n) Source #

Update the editor based on Brick events.

In addition to the canonical typing events, this editor also supports:

  • PageUp, PageDown, Home, and End keys.
  • Alt+Up shifts the view upward one line.
  • Alt+Down shifts the view downward one line.
  • Alt+Home shifts the view to hide empty space at the bottom.

To disable or override any of these keys, intercept them in the main handler for the App.

mapEditor :: WrappingEditorAction c -> WrappingEditor c n -> WrappingEditor c n Source #

Update the editor state.

newEditor :: FixedFontParser a c => a -> n -> [[c]] -> WrappingEditor c n Source #

Create a new WrappingEditor using the default editor component.

renderEditor :: (Ord n, Show n) => Bool -> WrappingEditor Char n -> Widget n Source #

Render the editor as a Widget.

updateEditorExtent :: Eq n => WrappingEditor c n -> EventM n (WrappingEditor c n) Source #

Updates the viewport size based on the most-recent rendering of the editor.

Call this before any custom event-handling logic so that the viewport is the correct size. This will ensure that vertical cursor movements match what the user expects.