Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
vim: Fix panic when scrolling beyond last line (#34172)
Conrad Irwinca0f0cc8d1ef
diff --git a/crates/vim/src/normal/scroll.rs b/crates/vim/src/normal/scroll.rsindex 47b9fe92fd9..e2ae74b52bc 100644--- a/crates/vim/src/normal/scroll.rs+++ b/crates/vim/src/normal/scroll.rs@@ -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,