pub fn move_cursor_visual(
geom: &TextGeometry,
buf: &TextBuffer,
cur: TextCursor,
motion: CursorMotion,
) -> (TextPos, Option<f32>)Expand description
D6: resolve a soft-wrap-aware vertical / line-bound motion against shaped
TextGeometry. Returns (new head, new goal_x): the goal x to store
back on the cursor (Qt verticalMovementX, D5).
LineUp/LineDown: step one visual line, landing on the byte whose caret x is nearest the stickygoal_x(seeded from the caret’s current x whengoal_xisNone); the goal is preserved across the move so a run of Up/Down tracks the original column. At the top / bottom visual line the motion delegates to the byte-onlymove_cursor(doc start / end), matching Qt.LineStart/LineEnd: snap to the VISUAL line’s byte bounds (soft-wrap aware), clearing the goal like any horizontal motion.- Any other motion delegates to
move_cursorand clears the goal.
No shaper dependency: the caller passes the geometry the producer already
shaped. Falls back naturally when the geometry is empty (single logical
line via move_cursor).