Skip to main content

Module wrap

Module wrap 

Source
Expand description

Row counting for the input TextArea.

ratatui_textarea::TextArea does not expose how many on-screen rows its content occupies, so counting them requires the very wrapping algorithm the widget renders with. The functions in this module are a simplified copy of wrap.rs from ratatui-textarea v0.9.2 (MIT), dropping the line-number gutter and tab-stop width logic, and the actual range handling (we only need a number of lines as the result).

Functionsยง

display_width ๐Ÿ”’
Total display width of the given text.
split_range_by_grapheme_width ๐Ÿ”’
Wraps the given byte range of a line at grapheme boundaries, accounting for wide characters.
wrap_word_chunks ๐Ÿ”’
Wraps the given line at word boundaries, falling back to grapheme splitting for words wider than the width when enabled.
wrapped_line_count ๐Ÿ”’
How many lines need to be rendered for the given mode, at least 1.