Skip to main content

Module scroll

Module scroll 

Source
Expand description

Visual-line-aware scrollable text rendering.

Ratatui’s Paragraph::scroll() counts visual lines (post-wrap), but most callers only know logical line counts. When Wrap is enabled, long lines expand into multiple visual rows, so a naïve total_logical - viewport scroll offset falls short of the true bottom.

ScrollState + render_scrollable() solve this by computing visual line counts the same way ratatui does (ceil(line_width / viewport_width)), keeping auto-scroll pinned to the real bottom.

Structs§

ScrollState
Scroll state for a scrollable text region.

Functions§

render_scrollable
Render lines into area with visual-line-aware scrolling.