Expand description
Built-in modeline element vocabulary + shared per-pane content resolution (slice ML.1a-render).
The modeline’s content strategy is common across renderers: this
module computes each built-in element’s ElementContent (text +
theme role) from (pane, RenderState), host-side, so the TUI
(ML.1a) and GPUI (ML.2) peers paint identical content and differ
ONLY in layout / paint (and GPUI-only richness like tooltips and
clicks). See docs/dev/architecture/modeline.md §4 (host-side
computation), §8 (theme roles), §10 (cross-renderer parity).
Two halves:
- descriptors —
register_builtin_elementsregisters thecore.*set into the sharedModelineServiceonce at boot (host owns the built-ins; modes/plugins own theirs, §6). - content —
resolve_builtin_contentcomputes per-pane built-in (core.*) content host-side. Mode/plugin elements (lsp,diff, …) are pushed over the event bus and drained into the content store (ML.3); the renderer reads them from the snapshot, so they never round-trip through this module.
Structs§
- Modeline
HitMap - ML.4: every clickable region on screen, rebuilt each frame.
- Modeline
HitZone - ML.4: one clickable region of a painted modeline row.
- Modeline
Layout - A pane modeline’s resolved per-zone layout (ML.5): the ordered
element descriptors for each zone after applying the
ui.modeline.*config, plus the configured inter-element separator. Descriptors are borrowed from the snapshot registry ('a).
Constants§
- CORE_
LANG - Detected language label. Right zone, far right.
- CORE_
MODE - Modal-state label (
[NORMAL]). Left zone, first. - CORE_
PATH - Buffer path + dirty marker (or a pane provider’s custom label).
- CORE_
POSITION - Cursor line:column. Right zone.
- CORE_
ZOOM - ZP.4: zoom marker (
Z) on the zoomed pane. Right zone, ahead of position — the marker is state about the pane, not about where the cursor is in it, so it reads better beside the mode tag’s side of the row than buried pastline:col. - ROLE_
LANG - ROLE_
MODE - ROLE_
MODE_ ITEM - The modeline role a mode tags content with when it
contributes a segment to the modeline (e.g. diff-mode’s
+N ~Mstats) (DX.4, BC.6). Lives inlattice-mode(not host) because it is the role modes reach for —ModelineRole::new(ROLE_MODE_ITEM)— so it belongs with the mode-contribution substrate, lettinglattice-diffreach it without the host. The host’s own element roles (modeline.path,modeline.position,modeline.lang,modeline.mode) stay host-side; the host re-exports this one so renderer style maps +crate::modelinecall sites are unchanged. - ROLE_
PATH - ROLE_
POSITION - ROLE_
ZOOM - ZP.4: the zoom marker’s role. Reuses the mode role’s slot in the theme rather than minting a colour: the marker is modal state about the pane, and matching the mode tag is what says so.
Functions§
- modal_
label - Modal-state short label for the active document, read from the
published
RenderState(no actor crossing). Shared by the modeline resolver and the renderers’modal_labelaccessors so the vocabulary has one definition. - modal_
label_ short - Lean 3-letter modal label for the modeline (ML.5d). The full
name (
modal_label) is echoed in the echo area on mode change; the persistent modeline tag stays compact + modern (Helix-styleNOR/INS/VIS), disambiguated by colour through themodeline.modetheme role. Same source-of-truth read asmodal_label(publishedRenderState, no actor crossing). - pane_
path_ segment - The buffer-label segment for
pane: a pane provider’s custom label when one is supplied (provider_label— the file-tree / oil / help M.4 mechanism, resolved renderer-side and passed in so the assembly stays common), else the document path + dirty marker (or the registry name slot for non-document panes). Empty only for the genuinely-nameless case, which the caller treats as hidden. - register_
builtin_ elements - Register the host’s built-in modeline descriptors. Called once at
boot against the shared service (the same instance the renderers
snapshot and modes reach via
ctx.service::<ModelineServiceHandle>()). Priorities are uniform leftward→rightward in every zone; the renderer right-aligns the Right block (seeZone). - resolve_
builtin_ content - Resolve a built-in (
core.*) element’s content forpane. Pure reads off the publishedRenderState— O(1), no allocation proportional to document size (paramount #1). - resolve_
layout - Resolve the full per-zone modeline layout for a pane from the
descriptor registry + the
ui.modeline.{left,center,right,separator}typed options (ML.5; design §11).