GGUI/Public/TextEdit.h file

TextEditState: a caret and selection over a TextBuffer, plus the editing operations.

The basis of every text widget; also usable on its own (console command line, tests). It holds no text. The caret and selection ends are anchors in the buffer, so they stay correct when something else edits it.

Movement    by grapheme (a letter with its accents, a multi-codepoint emoji), word, line,
            and document end
Selection   any movement can extend it; select word, select line
Editing     type, paste, backspace/delete by character or word, cut; each is one transaction
Rules       single line, max length, digits only, read only
IME         composition is shown inline and stays out of undo history until committed

Up and Down move between buffer lines. A widget that wraps text handles those itself, using its layout.

Not thread-safe: use on the thread that updates the document showing the buffer.

Namespaces

namespace GGUI

Classes

struct GGUI::TextEditRules
What edits a TextEditState allows.
class GGUI::TextEditState
A caret and selection over a TextBuffer, and the edits made at them. See the file description.