Skip to main content

Module movement

Module movement 

Source
Expand description

Cursor motion over a rope. Pure functions on (text, position), so every rule here is testable without constructing a crate::Buffer.

Char-wise, not grapheme-wise, for now. ADR-0006 §1 puts grapheme awareness at this layer — one arrow press should cross a whole cluster, so an emoji with a skin-tone modifier takes one keypress and not three. That refinement belongs here when it lands and changes nothing above; the change representation stays char-indexed either way, which is exactly why the ADR separated the two.

Functions§

column_of
The column of pos within its line, in chars.
down
left
line_end
Last char of the line pos is on, before its terminator — pressing End should land at the end of the visible text, not on the far side of the newline.
line_of
The line pos sits on.
line_start
First char of the line pos is on.
right
up
Move one line up, aiming for goal if the caller is tracking a sticky column.