Text Editing

Text input is a first-class feature of XenoAtom.Terminal.UI: you get a shared editing engine across multiple controls, with selection, clipboard, undo/redo, scrolling, and integrated Find/Replace.

TextArea with Search/Replace popup

Controls built on the text infrastructure

These controls share the same editing engine and most of the same user experience:

  • TextBox — single-line editor, password mode, overflow indicators
  • TextArea — multi-line editor, soft wrapping, Find/Replace popup
  • MaskedInput — structured templates (credit cards, dates, IDs, etc.)
  • NumberBox — numeric value binding with inline validation

Other controls also use the same infrastructure for parts of their UX:

Editing features

Across the editors above you typically get:

  • Caret + selection: keyboard and mouse selection, text element (grapheme) aware navigation.
  • Clipboard: copy/cut/paste shortcuts when enabled by the control’s clipboard mode/settings.
  • Undo/redo: built-in history (Ctrl+Z / Ctrl+R) integrated with programmatic edits.
  • Overflow + scrolling:
    • Single-line editors provide overflow indicators when content is wider than the viewport.
    • Multi-line editors integrate with ScrollViewer via IScrollable.

Most controls expose their shortcuts as commands, so a focused editor can be discoverable via a CommandBar.

Undo / redo

Text editors support undo/redo:

  • Ctrl+Z: undo
  • Ctrl+R: redo

See Undo/Redo.

Find / Replace

TextArea includes a built-in Find / Replace UI powered by the reusable SearchReplacePopup:

  • Ctrl+F: Find
  • Ctrl+H: Replace

The same popup component is also used by other controls (for example, LogControl hosts it in Find-only mode).

Find/Replace is hosted by the editor control and rendered as a window-layer popup in fullscreen apps. The host keeps the popup anchored to the editor and forwards query/navigation updates through an ISearchReplaceTarget.

Scroll integration

Text editors that can extend beyond their viewport implement IScrollable, so they integrate naturally with ScrollViewer:

new ScrollViewer(new TextArea(longText))

How it works (conceptual)

The text editing stack is split into a few focused parts:

  • TextEditorBase: shared control base for editors (focus, commands, cursor integration).
  • TextEditorCore: editing behavior (navigation, selection, word operations, clipboard, undo/redo, search matches).
  • ITextDocument: document abstraction for storage and edits.
    • TextDocument: a simple document implementation.
    • DynamicTextDocument: bridges a bindable Text property to the editor engine.
  • ScrollModel: viewport/extent model used by IScrollable controls and ScrollViewer.

The caret is rendered using the terminal cursor (not a fake reverse-video “block” cell), which keeps rendering stable and works well with accessibility settings in many terminals.

See also