Fix panic folding in multi-buffers (#21511)

Closes #19054

Rename `max_buffer_row()` to `widest_line_number()` to (hopefully)
prevent
people assuming it means the same as `max_point().row`.

Release Notes:

- Fixed a panic when folding in a multibuffer
This commit is contained in:
Conrad Irwin
2024-12-04 00:01:32 -07:00
committed by GitHub
parent e231321655
commit 196fd65601
10 changed files with 46 additions and 40 deletions
+2 -2
View File
@@ -154,9 +154,9 @@ impl Vim {
// contains a newline (so that delete works as expected). We undo that change
// here.
let is_last_line = linewise
&& end.row == buffer.max_buffer_row().0
&& end.row == buffer.max_row().0
&& buffer.max_point().column > 0
&& start.row < buffer.max_buffer_row().0
&& start.row < buffer.max_row().0
&& start == Point::new(start.row, buffer.line_len(MultiBufferRow(start.row)));
if is_last_line {