vim: Fix panic when scrolling beyond last line (#34172)

cc @dinocosta

Release Notes:

- (preview only) vim: Fix panic when scrolling down at end of file
This commit is contained in:
Conrad Irwin 2025-07-09 19:37:16 -06:00 committed by GitHub
parent a133c1311d
commit ca0f0cc8d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -230,7 +230,11 @@ fn scroll_editor(
// column position, or the right-most column in the current
// line, seeing as the cursor might be in a short line, in which
// case we don't want to go past its last column.
let max_row_column = map.line_len(new_row);
let max_row_column = if new_row <= map.max_point().row() {
map.line_len(new_row)
} else {
0
};
let max_column = match min_column + visible_column_count as u32 {
max_column if max_column >= max_row_column => max_row_column,
max_column => max_column,