MCPcopy Create free account
hub / github.com/GCWing/BitFun / move_cursor_up

Method move_cursor_up

src/apps/cli/src/ui/text_input.rs:139–149  ·  view source on GitHub ↗

Move cursor up one logical line. Returns false if already on first line.

(&mut self)

Source from the content-addressed store, hash-verified

137
138 /// Move cursor up one logical line. Returns false if already on first line.
139 pub fn move_cursor_up(&mut self) -> bool {
140 let (line, col, _) = self.cursor_line_col();
141 if line == 0 {
142 return false;
143 }
144 let counts = self.input_line_char_counts();
145 let prev_len = counts[line - 1];
146 let target_col = col.min(prev_len);
147 self.cursor = counts[..line - 1].iter().sum::<usize>() + (line - 1) + target_col;
148 true
149 }
150
151 /// Move cursor down one logical line. Returns false if already on last line.
152 pub fn move_cursor_down(&mut self) -> bool {

Callers 1

handle_keyMethod · 0.80

Calls 3

cursor_line_colMethod · 0.80
iterMethod · 0.80

Tested by

no test coverage detected