WEditorBrick-0.2.0.1: 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 e. (FixedFontViewer e c, FixedFontEditor e c) => e -> e Source #

Any action that updates the editor state.

type WrappingEditorDoer c b = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> 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 e c, FixedFontEditor e c) => n -> e -> 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 handler 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 p c => p -> 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 #

Update 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.