Change summary
crates/editor/src/editor.rs | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
Detailed changes
@@ -5792,8 +5792,11 @@ impl Editor {
&mut self,
cx: &mut ViewContext<Self>,
) -> Option<(fn(&Theme) -> Color, Vec<Range<Anchor>>)> {
- cx.notify();
- self.background_highlights.remove(&TypeId::of::<T>())
+ let highlights = self.background_highlights.remove(&TypeId::of::<T>());
+ if highlights.is_some() {
+ cx.notify();
+ }
+ highlights
}
#[cfg(feature = "test-support")]
@@ -5907,9 +5910,13 @@ impl Editor {
&mut self,
cx: &mut ViewContext<Self>,
) -> Option<Arc<(HighlightStyle, Vec<Range<Anchor>>)>> {
- cx.notify();
- self.display_map
- .update(cx, |map, _| map.clear_text_highlights(TypeId::of::<T>()))
+ let highlights = self
+ .display_map
+ .update(cx, |map, _| map.clear_text_highlights(TypeId::of::<T>()));
+ if highlights.is_some() {
+ cx.notify();
+ }
+ highlights
}
fn next_blink_epoch(&mut self) -> usize {