feat: fixed hover popup

pull/10695/head
roadup 7 months ago
parent 61818996c6
commit 677ef31968

@ -980,7 +980,7 @@ pub fn hover(cx: &mut Context) {
// skip if contents empty
let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
let popup = Popup::new("hover", contents).auto_close(true);
let popup = Popup::new("hover", contents).auto_close(true).position(editor.cursor().0);
compositor.replace_or_push("hover", popup);
}
},

@ -124,15 +124,10 @@ impl<T: Component> Popup<T> {
}
fn render_info(&mut self, viewport: Rect, editor: &Editor) -> RenderInfo {
let mut position = editor.cursor().0.unwrap_or_default();
if let Some(old_position) = self
let position = self
.position
.filter(|old_position| old_position.row == position.row)
{
position = old_position;
} else {
self.position = Some(position);
}
.or_else(|| editor.cursor().0)
.unwrap_or_default();
let is_menu = self
.contents

Loading…
Cancel
Save