Moves the cursor down by the given number of lines in `nlines` or to the last line if there are insufficient lines to perform the move.
(&mut self, nlines: usize)
| 247 | /// Moves the cursor down by the given number of lines in `nlines` or to the last line if there |
| 248 | /// are insufficient lines to perform the move. |
| 249 | fn move_down(&mut self, nlines: usize) { |
| 250 | if self.file_pos.line + nlines < self.content.len() { |
| 251 | self.file_pos.line += nlines; |
| 252 | } else { |
| 253 | self.file_pos.line = self.content.len() - 1; |
| 254 | } |
| 255 | |
| 256 | let line = &self.content[self.file_pos.line]; |
| 257 | self.file_pos.col = cmp::min(self.insert_col, line.len()); |
| 258 | } |
| 259 | |
| 260 | /// Moves the cursor up by the given number of lines in `nlines` or to the first line if there |
| 261 | /// are insufficient lines to perform the move. |