From 864d4bc1d133e5beb24c64bc0bf7336fc274ed1c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 16 Aug 2025 09:55:46 +0200 Subject: [PATCH] editor: Drop multiline targets in navigation buffers (#36291) Release Notes: - N/A --- crates/editor/src/editor.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 85f2e01ed4..0111e91347 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -15909,10 +15909,15 @@ impl Editor { .text_for_range(location.range.clone()) .collect::() }) + .filter(|text| !text.contains('\n')) .unique() .take(3) .join(", "); - format!("{tab_kind} for {target}") + if target.is_empty() { + tab_kind.to_owned() + } else { + format!("{tab_kind} for {target}") + } }) .context("buffer title")?; @@ -16117,10 +16122,15 @@ impl Editor { .text_for_range(location.range.clone()) .collect::() }) + .filter(|text| !text.contains('\n')) .unique() .take(3) .join(", "); - let title = format!("References to {target}"); + let title = if target.is_empty() { + "References".to_owned() + } else { + format!("References to {target}") + }; Self::open_locations_in_multibuffer( workspace, locations,