MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / visual_move_down

Function visual_move_down

src/text_input.rs:1688–1696  ·  view source on GitHub ↗

Navigate cursor one visual line down. Returns the new global cursor position.

(visual_lines: &[VisualLine], cursor_pos: usize, text_len: usize)

Source from the content-addressed store, hash-verified

1686
1687/// Navigate cursor one visual line down. Returns the new global cursor position.
1688pub 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.
1699pub fn visual_line_home(visual_lines: &[VisualLine], cursor_pos: usize) -> usize {

Callers 1

Calls 1

cursor_to_visual_posFunction · 0.85

Tested by

no test coverage detected