Navigate cursor one visual line down. Returns the new global cursor position.
(visual_lines: &[VisualLine], cursor_pos: usize, text_len: usize)
| 1686 | |
| 1687 | /// Navigate cursor one visual line down. Returns the new global cursor position. |
| 1688 | pub fn visual_move_down(visual_lines: &[VisualLine], cursor_pos: usize, text_len: usize) -> usize { |
| 1689 | let (line, col) = cursor_to_visual_pos(visual_lines, cursor_pos); |
| 1690 | if line >= visual_lines.len() - 1 { |
| 1691 | return text_len; // Already on last visual line → move to end |
| 1692 | } |
| 1693 | let target_line = &visual_lines[line + 1]; |
| 1694 | let new_col = col.min(target_line.char_count); |
| 1695 | target_line.global_char_start + new_col |
| 1696 | } |
| 1697 | |
| 1698 | /// Move to start of current visual line. Returns the new global cursor position. |
| 1699 | pub fn visual_line_home(visual_lines: &[VisualLine], cursor_pos: usize) -> usize { |
no test coverage detected