diff --git a/crates/find/src/find.rs b/crates/find/src/find.rs index 6f7312c7d19e22739b38087806c2a2ae1d78f8de..76beed1f2ef21d15505c02fe92c53ed3f591738a 100644 --- a/crates/find/src/find.rs +++ b/crates/find/src/find.rs @@ -431,13 +431,17 @@ impl FindBar { } fn clear_matches(&mut self, cx: &mut ViewContext) { - for (editor, _) in self.editors_with_matches.drain() { + let mut active_editor_matches = None; + for (editor, ranges) in self.editors_with_matches.drain() { if let Some(editor) = editor.upgrade(cx) { - if Some(&editor) != self.active_editor.as_ref() { + if Some(&editor) == self.active_editor.as_ref() { + active_editor_matches = Some((editor.downgrade(), ranges)); + } else { editor.update(cx, |editor, cx| editor.clear_highlighted_ranges::(cx)); } } } + self.editors_with_matches.extend(active_editor_matches); } fn update_matches(&mut self, select_closest_match: bool, cx: &mut ViewContext) {