Editing

Syntax editors

Edit bounded multiline text with token highlighting and a caller-selected line limit.

Generated previewCharm
Dedicated Syntax editors example rendered in the Charm skin

The site build compiles the dedicated Ada component example, constructs Syntax editors through its public API, and exports that exact styled surface. Read the capture source.

When to use it

Use a syntax editor when source text needs responsive editing plus a deterministic external lexer.

State and ownership

The Flyology_TUI.Components.Syntax_Editors package defines this component.

One text-area state machine owns editing. A bounded per-line token cache stores lexer state and validated token spans that start and end at grapheme boundaries.

  • The application model owner applies updates during serial event dispatch.
  • Appearance and skin values are borrowed only while the component renders.

Input and updates

Editing behavior matches a text area. The caller advances highlighting under an explicit line budget.

Integration sequence

  1. Create the bounded model and populate it with caller-owned data.
  2. Route the current keyboard or local mouse event through the component handler.
  3. Apply the typed result, then render from the updated model with the current appearance.

See the linked package reference for its exact declarations and contracts.

Responsive and accessible behavior

  • Use dimensions and regions from the current layout or presentation value.
  • When a component owns mouse capture, route its matching release even when the pointer leaves the original bounds.
  • Retain a glyph, label, border, or text-attribute cue when the terminal reduces color.