pub struct DocView {Show 16 fields
pub rows: Vec<Row>,
pub tables: Vec<TableView>,
pub directives: Vec<DirectiveView>,
pub media: Vec<MediaView>,
pub caret_row: u32,
pub caret_col: u32,
pub caret_ch: u32,
pub caret_src: u32,
pub has_selection: bool,
pub anchor_row: u32,
pub anchor_ch: u32,
pub dirty: bool,
pub view: String,
pub heading: Option<u32>,
pub active: Vec<String>,
pub link: Option<String>,
}Expand description
A whole rendered frame: the rows to paint, where the caret sits, and the toolbar state — everything the Swift side needs for one repaint, in one value. Returned by every view-producing method.
Fields§
§rows: Vec<Row>§tables: Vec<TableView>Tables described structurally, for a frontend that draws its own grid
instead of painting the box-glyph rows. Empty in the source view. Each
names the rows span its picture occupies, to be skipped.
directives: Vec<DirectiveView>Leaf directives (::name{…}) described structurally, for a frontend that
paints what the host app’s vocabulary makes of them instead of the ⧉
placeholder row. Empty in the source view, where the directive is the
literal text the caret is editing.
media: Vec<MediaView>Block-level images, videos, and audio described structurally, for a
frontend that lays real views over the rows core reserved instead of
painting the placeholder glyphs. Empty in the source view, where the
 or <video> markup is the literal text being edited.
caret_row: u32The caret’s row: an index into Self::rows.
caret_col: u32The caret’s display column within its row — core’s grid position. Kept
for callers reasoning in columns; a proportional renderer wants
Self::caret_ch instead.
caret_ch: u32The caret’s offset within its row’s text in UTF-16 code units — what
NSAttributedString/NSTextView count to. This is caret_col mapped
through the row’s grapheme widths, so it lands the caret correctly past
wide glyphs (CJK, emoji) where a column and a character index diverge.
caret_src: u32The caret’s source byte offset — the coordinate a table cell is keyed
by (TableCellView::start/end), so a frontend drawing its own grid can
find which cell the caret sits in without the picture-row indices.
has_selection: boolWhether a (non-empty) selection is active.
anchor_row: u32The selection’s fixed end (the caret is the moving end), as a row and a
UTF-16 offset — so the renderer can restore a native selection with the
same direction the model has. Equal to the caret when has_selection is
false.
anchor_ch: u32§dirty: boolWhether the buffer differs from the last saved bytes — for a “● modified” affordance.
view: String"wysiwyg" or "source", for a view-toggle affordance.
heading: Option<u32>The heading level at the caret, if any — a toolbar lights H1…H6 from it.
active: Vec<String>The inline marks active at the caret (bold, italic, code, …) — the
toolbar lights the matching buttons.
link: Option<String>The destination of the link the caret stands in, or None — the toolbar
lights its Link button from it and seeds an edit of that link with it.
It rides the frame rather than being a query a toolbar makes for itself
because a toolbar only redraws when the state changes: walking the caret
out of a link changes no mark, no heading, and no dirty flag, so a Link
button reading this by a call of its own would keep a stale light on. Same
reason heading is here and not asked for.
Only a parsed link answers (LeafDoc::link_destination_at_caret);
a wikilink is literal text with no node behind it, and has nothing to
repoint — see LinkTarget.swift.