Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Only count existing branches in picker search (#22908)

Aaron Feickert8b4370f1704b
diff --git a/crates/vcs_menu/src/lib.rs b/crates/vcs_menu/src/lib.rs
index 5dc02cc7c22..d66628c2d15 100644
--- a/crates/vcs_menu/src/lib.rs
+++ b/crates/vcs_menu/src/lib.rs
@@ -128,6 +128,13 @@ impl BranchListDelegate {
branch_name_trailoff_after,
})
}
+
+ fn branch_count(&self) -> usize {
+ self.matches
+ .iter()
+ .filter(|item| matches!(item, BranchEntry::Branch(_)))
+ .count()
+ }
}
impl PickerDelegate for BranchListDelegate {
@@ -308,8 +315,8 @@ impl PickerDelegate for BranchListDelegate {
.into_any_element()
} else {
let match_label = self.matches.is_empty().not().then(|| {
- let suffix = if self.matches.len() == 1 { "" } else { "es" };
- Label::new(format!("{} match{}", self.matches.len(), suffix))
+ let suffix = if self.branch_count() == 1 { "" } else { "es" };
+ Label::new(format!("{} match{}", self.branch_count(), suffix))
.color(Color::Muted)
.size(LabelSize::Small)
});