final class UITextArea
package smidr.widgets
extends UIComponent
implements UIStyledText, IUIFocusable
A multi-line, scrollable text editor — the note-taking / code surface the single-line
UITextInput is not. It owns text editing (caret, selection, scrolling, clipboard, variable
line heights) but is deliberately style-agnostic: it carries one opaque Int style word per
character and defers all meaning to an optional installed styler (smidr.text.UITextStyler).
- With no styler it is a plain uniform-format multi-line field (what mobile / plain callers want) — the style words are ignored.
- Install
styler = new smidr.text.UIRichStyler()for WYSIWYG formatting (bold / italic / underline / colour / size / headings / lists). The editor never interprets the bits; the styler turns them intoTextFormatruns, list markers, indentation and outline boxes, and decides how style flows across a line break. Markdown import/export lives insmidr.text.UIMarkdown.
Editing: printable input, Enter for newlines, Tab, Backspace/Delete, Left/Right (Ctrl = word
jump), Up/Down with a desired column, Home/End (Ctrl = document ends), PageUp/PageDown,
Ctrl+A/C/X/V. Word-wrap by default; vertical scroll via wheel, a draggable thumb and drag-to-
scroll on mobile. Set readOnly for a selectable-but-immutable viewer. Implements UIStyledText
so styling modules can transform its style words without depending on this widget.
Constructor
new(width:Float, height:Float, text:String = "")
Parameters:
width | layout width (the scrollbar lives inside it) |
|---|---|
height | the visible viewport height |
text | the initial content |
Variables
wordWrap:Bool = true
Soft-wrap long lines to the field width (default on); false clips and scrolls the caret.
onCaretMove:() ‑> Void = null
Fired whenever the caret or selection moves (for a line/column or toolbar readout).
Methods
setRich(newText:String, styleData:Array<Int>):Void
Loads text and its parallel style words together (restores saved formatting).
styleParagraphs(map:Int ‑> Int):Void
Applies map to every character in the paragraphs the selection touches (and typingStyle).
styleSelection(map:Int ‑> Int):Void
Applies map to every selected character's style, or to typingStyle when nothing is selected.