Skip to main content

Module layout

Module layout 

Source
Expand description

The layout layer (0017, R6 in 0031): one line’s byte↔display-cell maps and grapheme boundaries. Every visible-line consumer — renderer, cursor placement, selection overlays, diagnostics, mouse hit-testing — reads this instead of deriving positions by char index.

Cells are id::DisplayColumn (unsaturated usize): positions past 65535 columns stay exact; u16 exists only at the final terminal conversion in the renderer. Storage stays byte-native (ByteOffset is canonical); this is the single translation seam. RopeGraphemes streams clusters off a rope slice so long lines never pay a whole-line String or layout vector.

Structs§

CellClip
A glyph’s intersection with the visible cell window.
GraphemeSpan
One grapheme cluster’s placement on the line.
LayoutCheckpoint
LineLayout
A laid-out line: grapheme spans in order.
LineLayoutIndex
PreparedLineLayout
RopeGraphemes
Streaming grapheme iteration over a rope slice, chunk-aligned like ropey’s own iteration: only a cluster crossing rope chunks needs an owned string. Carries the absolute cell so consumers never re-walk.

Constants§

INLINE_LAYOUT_BYTES

Functions§

clip
Clip one grapheme span to [origin, origin+width). None when the cluster occupies no cell in the window (zero-width or fully outside).
printable_grapheme
A terminal cell must contain printable text, never protocol bytes. Use the same one-cell replacement in layout and emission; tab expansion is separate.
printable_text
Printable metadata with the same grapheme policy as buffer emission. Preserve an already-owned label without copying when no control needs replacing.