diff --git a/crates/find/src/find.rs b/crates/find/src/find.rs index f1725d4b9629bcd002340ee4f1e7035eff3fd066..6b8a061892f34c4572cf38a52eadfeb3b6a57b46 100644 --- a/crates/find/src/find.rs +++ b/crates/find/src/find.rs @@ -107,14 +107,16 @@ impl View for FindBar { let (_, highlighted_ranges) = editor.read(cx).highlighted_ranges_for_type::()?; let match_ix = cmp::min(self.active_match_index? + 1, highlighted_ranges.len()); + let message = if highlighted_ranges.is_empty() { + "No matches".to_string() + } else { + format!("{} of {}", match_ix, highlighted_ranges.len()) + }; Some( - Label::new( - format!("{} of {}", match_ix, highlighted_ranges.len()), - theme.match_index.text.clone(), - ) - .contained() - .with_style(theme.match_index.container) - .boxed(), + Label::new(message, theme.match_index.text.clone()) + .contained() + .with_style(theme.match_index.container) + .boxed(), ) })) .contained()