Expand description
Direct cell-write ratatui::widgets::Widget for hjkl_buffer::Buffer.
§Render path
BufferView implements
ratatui::widgets::Widget. The widget is single-pass — text,
selection, gutter signs, and styled spans all paint together. There is
no separate Paragraph or layout step. Writes one cell at a time so
syntax span fg, cursor-line bg, cursor cell REVERSED, and selection bg
layer in a single pass without the grapheme / wrap machinery Paragraph
does.
Caller wraps a &Buffer in BufferView, hands it the style table
that resolves opaque hjkl_buffer::Span style ids to real ratatui styles
via a StyleResolver, and renders into a ratatui::Frame.
§StyleResolver hooks
The StyleResolver trait is the host’s bridge from opaque u32 style
ids (stored in hjkl_buffer::Span::style) to real ratatui::style::Style
values. Implement it against your own theme. A convenience blanket impl
exists for closures Fn(u32) -> Style.
Structs§
- Buffer
View - Render-time wrapper around
&Bufferthat carries the optionalSelection+ aStyleResolver. Created per draw, dropped when the frame is done — cheap, holds only refs. - Conceal
- Render-time substitution that hides a byte range and paints
replacementin its place. The buffer’s content stays unchanged; only the rendered cells differ. Used by hosts to pretty-print URLs, conceal markdown markers, etc. - Diag
Overlay - A char-column range on a document row that should be styled with an overlay (e.g. an underline for LSP diagnostics). Applied in a post-paint pass so it composes on top of syntax and selection colours.
- EolHint
- End-of-line virtual text (e.g. inline git blame). Painted in the trailing
cells of
rowafter its real text, instyle, with a 2-column gap. Purely decorative — occupies no buffer bytes and never affects cursor motion or layout. Truncated at the right edge of the text area; skipped when the row’s text already fills the width. - Gutter
- Configuration for the line-number gutter rendered to the left of
the text area.
widthis the number-column cell count reserved (including any trailing spacer); the renderer right-aligns the 1-based row number into the leftmostwidth - 1cells. - Sign
- Single-cell marker painted into the leftmost gutter column for a
document row. Used by hosts to surface LSP diagnostics, git diff
signs, etc. Higher
prioritywins when multiple signs land on the same row.
Enums§
- Blame
Row - One screen row in a boxed-blame layout (
BufferView::blame_plan). - Gutter
Numbers - Controls what numbers are rendered in the gutter.
Constants§
- BLAME_
BOX_ FRAME_ LEFT - Left-frame width reserved by the boxed-blame layout (the
│/┌/└column). The host adds this when computing the cursor’s screen column.
Traits§
- Style
Resolver - Resolves an opaque
hjkl_buffer::Span::styleid to a real ratatui style. The buffer doesn’t know about colours; the host (sqeel-vim or any future user) keeps a lookup table.