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 // skip if contents empty
let contents = ui::Markdown::new(contents, editor.syn_loader.clone()); 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); 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 { fn render_info(&mut self, viewport: Rect, editor: &Editor) -> RenderInfo {
let mut position = editor.cursor().0.unwrap_or_default(); let position = self
if let Some(old_position) = self
.position .position
.filter(|old_position| old_position.row == position.row) .or_else(|| editor.cursor().0)
{ .unwrap_or_default();
position = old_position;
} else {
self.position = Some(position);
}
let is_menu = self let is_menu = self
.contents .contents

Loading…
Cancel
Save