nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Widgets.TextArea

Description

The multi-line text area widget and its state: the document buffer, caret and selection, viewport, and commands run against it.

Synopsis

Pure state

Widget

textArea :: forall (es :: [Effect]). Ui :> es => Text -> Eff es Text Source #

Multi-line text editor. Pass the current text; the result is the text after this frame's edits. Pair it with a label when a caption is wanted.

textArea' :: forall (es :: [Effect]). Ui :> es => Text -> Eff es (Response, Text) Source #

textAreaWith :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es Text Source #

textArea with a modifier applied to textAreaLayout, for example grow to fill the parent.

textAreaWith' :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es (Response, Text) Source #

loadTextAreaStateWithBuffer :: WidgetStore -> Int -> TextBuffer -> TextAreaState Source #

loadTextAreaState with the buffer already resolved (the paint path ensures the buffer cache and hands it straight through, avoiding a second store lookup).

saveTextAreaState :: Int -> Text -> TextAreaState -> WidgetStore -> WidgetStore Source #

Store the editor state with its text. Callers pass the text because they usually have it already, and toText joins the whole document.

runTextAreaCommand :: TextCommand -> TextAreaState -> TextAreaState Source #

Run a command that needs no clipboard, keeping the caret in view.

applyTextAreaCommand :: Context -> WidgetId -> TextCommand -> IO () Source #

Run a command on a text area outside its frame (a context menu row, an app's Edit menu). A change to the text pulses respChanged on the area's next frame.