Safe Haskell | Trustworthy |
---|
A wrapping text-editor with dynamic sizing for Brick.
Synopsis
- data WrappingEditor c n
- type WrappingEditorAction c = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> e
- type WrappingEditorDoer c b = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> b
- doEditor :: WrappingEditorDoer c b -> WrappingEditor c n -> b
- dumpEditor :: WrappingEditor c n -> [[c]]
- genericEditor :: (FixedFontViewer e c, FixedFontEditor e c) => n -> e -> WrappingEditor c n
- handleEditor :: Eq n => WrappingEditor Char n -> Event -> EventM n (WrappingEditor Char n)
- mapEditor :: WrappingEditorAction c -> WrappingEditor c n -> WrappingEditor c n
- newEditor :: FixedFontParser p c => p -> n -> [[c]] -> WrappingEditor c n
- renderEditor :: (Ord n, Show n) => Bool -> WrappingEditor Char n -> Widget n
- updateEditorExtent :: Eq n => WrappingEditor c n -> EventM n (WrappingEditor c n)
Documentation
data WrappingEditor c n #
Editor widget for use with Brick.
Instances
Show n => Show (WrappingEditor c n) # | |
Defined in WEditorBrick.WrappingEditor showsPrec :: Int -> WrappingEditor c n -> ShowS show :: WrappingEditor c n -> String showList :: [WrappingEditor c n] -> ShowS | |
Named (WrappingEditor c n) n # | |
Defined in WEditorBrick.WrappingEditor getName :: WrappingEditor c n -> n |
type WrappingEditorAction c = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> e #
Any action that updates the editor state.
type WrappingEditorDoer c b = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> b #
Any action that reads the editor state.
doEditor :: WrappingEditorDoer c b -> WrappingEditor c n -> b #
Read from the editor state.
dumpEditor :: WrappingEditor c n -> [[c]] #
Dump the final contents of the edited document.
genericEditor :: (FixedFontViewer e c, FixedFontEditor e c) => n -> e -> WrappingEditor c n #
Create a new WrappingEditor
using a custom editor component.
handleEditor :: Eq n => WrappingEditor Char n -> Event -> EventM n (WrappingEditor Char n) #
Update the editor based on Brick events.
In addition to the canonical typing events, this handler also supports:
PageUp
,PageDown
,Home
, andEnd
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 #
Update the editor state.
newEditor :: FixedFontParser p c => p -> n -> [[c]] -> WrappingEditor c n #
Create a new WrappingEditor
using the default editor component.
renderEditor :: (Ord n, Show n) => Bool -> WrappingEditor Char n -> Widget n #
Render the editor as a Widget
.
updateEditorExtent :: Eq n => WrappingEditor c n -> EventM n (WrappingEditor c n) #
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.