mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 15:44:31 +03:00
Avoid re-rendering editor on mouse move
Only notify editor when clearing highlights if there were highlights to begin with. Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
bc03592912
commit
646d344a11
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user