Skip to main content

Module rich_text_line

Module rich_text_line 

Expand description

A single editable line of text wrapping a local-mode TextInput, the leaf cell of a block editor. The inner TextInput handles cursor placement, selection, IME, copy/paste; RichTextLine adds:

  • Intercepts Enter, Backspace at byte 0, Up at the start, and Down at the end before the inner input sees them, queuing LineSignals the parent (crate::widget::block_editor::BlockEditor) consumes instead.
  • A per-line font size so a block editor can render H1/H2/H3 headings without forking the widget.
  • A MarkSpan list (inline bold/italic/code/link) with rendering and Ctrl-B/I/E toggling built on the inner TextInput’s selection range.

Structs§

RichTextLine
TransientColorSpan
A presentation-only syntax colour over a byte range of the line, painted from the theme’s SyntaxPalette and never written to the document.

Enums§

LineSignal
Emitted when a key would carry the edit out of the line itself; the parent (a BlockEditor) drains these via RichTextLine::take_signal.

Functions§

chip_mono_width
Pulled out as a free function so the chip-sizing math is unit-testable independent of the full draw path.
link_at_byte
Used by MainPanel::handle_event to route clicks on link spans to the page-navigation handler.