Hide hover when font changes, and handle case where delay was preventing hover with large symbol range

This commit is contained in:
Keith Simmons 2022-06-08 11:54:24 -07:00
parent b51bd87c10
commit 1da1853a76
4 changed files with 43 additions and 17 deletions

View file

@ -5688,9 +5688,22 @@ impl Entity for Editor {
impl View for Editor {
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let style = self.style(cx);
self.display_map.update(cx, |map, cx| {
let font_changed = self.display_map.update(cx, |map, cx| {
map.set_font(style.text.font_id, style.text.font_size, cx)
});
// If the
if font_changed {
let handle = self.handle.clone();
cx.defer(move |cx| {
if let Some(editor) = handle.upgrade(cx) {
editor.update(cx, |editor, cx| {
hide_hover(editor, cx);
})
}
});
}
EditorElement::new(self.handle.clone(), style.clone(), self.cursor_shape).boxed()
}