Skip to main content

hjkl_buffer_tui/
lib.rs

1//! Direct cell-write `ratatui::widgets::Widget` for [`hjkl_buffer::Buffer`].
2//!
3//! ## Render path
4//!
5//! [`BufferView`] implements `ratatui::widgets::Widget`. The widget is
6//! **single-pass** — text, selection, gutter signs, and styled spans all paint
7//! together. There is no separate `Paragraph` or layout step. Writes one cell
8//! at a time so syntax span fg, cursor-line bg, cursor cell REVERSED, and
9//! selection bg layer in a single pass without the grapheme / wrap machinery
10//! `Paragraph` does.
11//!
12//! Caller wraps a `&Buffer` in [`BufferView`], hands it the style table
13//! that resolves opaque [`hjkl_buffer::Span`] style ids to real ratatui styles
14//! via a [`StyleResolver`], and renders into a `ratatui::Frame`.
15//!
16//! ## StyleResolver hooks
17//!
18//! The [`StyleResolver`] trait is the host's bridge from opaque `u32` style
19//! ids (stored in [`hjkl_buffer::Span::style`]) to real `ratatui::style::Style`
20//! values. Implement it against your own theme. A convenience blanket impl
21//! exists for closures `Fn(u32) -> Style`.
22
23pub mod render;
24
25pub use render::{BufferView, Conceal, DiagOverlay, Gutter, GutterNumbers, Sign, StyleResolver};