multi_buffer: Merge adjacent matches into a single excerpt when separated by only one line (#31708)

Closes #31252

Release Notes:

- Improved displaying of project search matches or diagnostics when the
excerpts are adjacent.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Kiran_Peraka 2025-06-03 15:37:59 +05:30 committed by GitHub
parent 59686f1f44
commit 07dab4e94a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -1690,7 +1690,9 @@ impl MultiBuffer {
last_range.context.start <= range.context.start, last_range.context.start <= range.context.start,
"Last range: {last_range:?} Range: {range:?}" "Last range: {last_range:?} Range: {range:?}"
); );
if last_range.context.end >= range.context.start { if last_range.context.end >= range.context.start
|| last_range.context.end.row + 1 == range.context.start.row
{
last_range.context.end = range.context.end.max(last_range.context.end); last_range.context.end = range.context.end.max(last_range.context.end);
*counts.last_mut().unwrap() += 1; *counts.last_mut().unwrap() += 1;
continue; continue;

View file

@ -1592,7 +1592,6 @@ fn test_set_excerpts_for_buffer_ordering(cx: &mut TestAppContext) {
six six
seven seven
eight eight
-----
nine nine
ten ten
eleven eleven
@ -1848,7 +1847,6 @@ fn test_set_excerpts_for_buffer_rename(cx: &mut TestAppContext) {
zero zero
one one
two two
-----
three three
four four
five five