Skip to main content

Module render

Module render 

Source
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§

BufferView
Render-time wrapper around &Buffer that carries the optional Selection + a StyleResolver. Created per draw, dropped when the frame is done — cheap, holds only refs.
Conceal
Render-time substitution that hides a byte range and paints replacement in its place. The buffer’s content stays unchanged; only the rendered cells differ. Used by hosts to pretty-print URLs, conceal markdown markers, etc.
DiagOverlay
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 row after its real text, in style, 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. width is the number-column cell count reserved (including any trailing spacer); the renderer right-aligns the 1-based row number into the leftmost width - 1 cells.
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 priority wins when multiple signs land on the same row.

Enums§

BlameRow
One screen row in a boxed-blame layout (BufferView::blame_plan).
GutterNumbers
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§

StyleResolver
Resolves an opaque hjkl_buffer::Span::style id to a real ratatui style. The buffer doesn’t know about colours; the host (sqeel-vim or any future user) keeps a lookup table.