multi_buffer: Fix handling of ExcerptId::max() (#38887)

This removes a hack from `MultiBuffer::anchor_at` that works around
missing logic for handling `ExcerptId::max()` by implementing that said
missing logic.

Generally, `ExcerptId::min()` is already being handled correctly due to
how `Cursor` seeking works, we tend to seek to or beyond a seek target,
meaning `min` will always match the first excerpt as expected. `max` on
the other hand will always seek beyond the last excerpt resulting in no
excerpt being found, so any code path dealing with the excerpt sumtree
will have to specially check for this special excerpt ID to work
correctly.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-01 07:43:22 +00:00
committed by GitHub
parent 01dbc68f82
commit fc0b249136
12 changed files with 114 additions and 164 deletions
+1 -1
View File
@@ -467,7 +467,7 @@ impl Vim {
let was_empty = range.is_empty();
let was_reversed = selection.reversed;
(
map.buffer_snapshot.anchor_at(start_offset, Bias::Left),
map.buffer_snapshot.anchor_before(start_offset),
end_offset - start_offset,
was_empty,
was_reversed,