fix: avoids panic
This commit is contained in:
parent
1f4065c1c3
commit
252078cfe4
1 changed files with 1 additions and 1 deletions
|
|
@ -1301,7 +1301,7 @@ impl Buffer {
|
||||||
cursor_x_opt = None;
|
cursor_x_opt = None;
|
||||||
}
|
}
|
||||||
Motion::BufferEnd => {
|
Motion::BufferEnd => {
|
||||||
cursor.line = self.lines.len() - 1;
|
cursor.line = self.lines.len().saturating_sub(1);
|
||||||
cursor.index = self.lines.get(cursor.line)?.text().len();
|
cursor.index = self.lines.get(cursor.line)?.text().len();
|
||||||
cursor_x_opt = None;
|
cursor_x_opt = None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue