Skip to main content

Module wrap

Module wrap 

Source
Expand description

Soft-wrap helpers shared between the renderer, viewport scroll, and the buffer’s vertical motion code.

Enums§

Wrap
Soft-wrap mode controlling how doc rows wider than the text area turn into multiple visual rows. Default is Wrap::None — every doc row is exactly one screen row and top_col clips the left side, mirroring vim’s set nowrap default for sqeel today.

Functions§

segment_for_col
Returns the index into segments whose [start, end) covers col. The past-end cursor (col == last segment's end) maps to the last segment, matching vim’s “EOL on the visual row that holds the line’s last char” behaviour.
wrap_segments
Split line into char-index segments [start, end) such that each segment’s display width fits within width cells. Wrap::Word rewinds to the last whitespace inside the candidate segment when a break would otherwise split a word; falls through to a char break for runs longer than width. Wrap::None is not expected here — callers branch before calling — but is handled for completeness as a single segment covering the full line.