Move cursor up one logical line. Returns false if already on first line.
(&mut self)
| 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 { |
no test coverage detected