Expand description
Renderer-agnostic layout for the Rustaco editor.
View turns a TextModel, one editor’s selections and a viewport into a Frame:
positioned text runs, selection rectangles, carets and line numbers. A frontend only
draws the frame; it never measures text or walks the rope itself. Only visible lines and
visible columns are laid out, so frame cost does not grow with file size.
All coordinates are CSS pixels relative to the viewport’s top-left corner, gutter included.
A model line shows as one or more rows (word wrap) or not at all (inside a fold).
Vertical geometry goes through View::line_top and View::line_at_y: a
HeightMap holds every line’s own height, rows times the line height, and folds are
taken out on top of it.
Structs§
- Fold
Marker - A fold marker in the gutter: the line heads a region that can be folded, or is folded.
- Frame
- One laid-out frame. Grows with features (minimap, sticky lines, zones): read its fields, do not build it.
- Frame
Line - One row on screen: a whole line, or one row of a wrapped line.
- Guide
- A vertical indentation guide in viewport coordinates.
- Height
Map - Line
Rows - The rows of one model line: the char column each row starts at (
starts[0]is 0) and the indentation, in cells, of every row after the first. - Metrics
- Font measurements supplied by the frontend.
- Minimap
Block - A run of non-blank chars with one style, in the minimap.
- Minimap
Frame - The minimap: the document at a small scale beside the text, each char a block of colour, with a slider over the part the viewport shows.
- Plain
- A styler that leaves everything at style 0.
- Rect
- Style
Span - A styled span on one line, in char columns. Spans are sorted and do not overlap.
- TextRun
- Consecutive chars with one style. Tabs are already expanded to spaces.
- View
Constants§
- INLAY_
STYLE - Style id of inlay hint runs; frontends draw them muted.
Traits§
- Styler
- Supplies syntax or semantic styling. Text outside every span gets style 0.
Functions§
- column_
at_ cells - Char column whose boundary is nearest to
cells(fractional) online. - indent_
fold_ ranges - Foldable regions from indentation: a non-blank line followed by more deeply indented lines heads a region ending at the last of them (trailing blank lines excluded). Used when no syntax tree gives better ranges, and for languages like Python where indentation is the structure.
- visual_
column - Cells from line start to char column
column, with tabs and wide chars expanded. - wrap_
line - Breaks
lineinto rows at mostwidthcells wide; seewrap_slice. - wrap_
slice - Breaks a line (with or without its line break) into rows at most
widthcells wide. Rows break after a run of spaces when the row holds one, otherwise inside the word. Spaces may hang past the edge, so a row never starts with the spaces that ended the previous one. Continuation rows are indented like the line itself, unless that indentation takes half the width or more.