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

Function visual_move_up

src/text_input.rs:1677–1685  ·  view source on GitHub ↗

Navigate cursor one visual line up. Returns the new global cursor position. `col` is the desired column (preserved across up/down moves).

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

Source from the content-addressed store, hash-verified

1675/// Navigate cursor one visual line up. Returns the new global cursor position.
1676/// `col` is the desired column (preserved across up/down moves).
1677pub fn visual_move_up(visual_lines: &[VisualLine], cursor_pos: usize) -> usize {
1678 let (line, col) = cursor_to_visual_pos(visual_lines, cursor_pos);
1679 if line == 0 {
1680 return 0; // Already on first visual line → move to start
1681 }
1682 let target_line = &visual_lines[line - 1];
1683 let new_col = col.min(target_line.char_count);
1684 target_line.global_char_start + new_col
1685}
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 {

Callers 1

Calls 1

cursor_to_visual_posFunction · 0.85

Tested by

no test coverage detected