Skip to content

Commit

Permalink
fix: avoids panic
Browse files Browse the repository at this point in the history
  • Loading branch information
ActuallyHappening authored and jackpot51 committed Dec 22, 2024
1 parent 1f4065c commit 252078c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ impl Buffer {
cursor_x_opt = None;
}
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_x_opt = None;
}
Expand Down

0 comments on commit 252078c

Please sign in to comment.