Move cursor down one logical line. Returns false if already on last line.
(&mut self)
| 150 | |
| 151 | /// Move cursor down one logical line. Returns false if already on last line. |
| 152 | pub fn move_cursor_down(&mut self) -> bool { |
| 153 | let (line, col, _) = self.cursor_line_col(); |
| 154 | let counts = self.input_line_char_counts(); |
| 155 | if line >= counts.len() - 1 { |
| 156 | return false; |
| 157 | } |
| 158 | let next_len = counts[line + 1]; |
| 159 | let target_col = col.min(next_len); |
| 160 | self.cursor = counts[..line + 1].iter().sum::<usize>() + (line + 1) + target_col; |
| 161 | true |
| 162 | } |
| 163 | |
| 164 | pub fn set_cursor_home(&mut self) { |
| 165 | let (_, _, line_start) = self.cursor_line_col(); |
no test coverage detected