show link url as tooltip on hover

This commit is contained in:
yggverse 2024-10-13 21:06:20 +03:00
parent b756e3e7c6
commit 7829e51bef

View File

@ -192,19 +192,21 @@ impl Reader {
if let Some(iter) = gobject.iter_at_location(buffer_x, buffer_y) {
for tag in iter.tags() {
// Tag contain URI (is link)
if let Some(_) = _links_.get(&tag) {
if let Some(uri) = _links_.get(&tag) {
// Toggle cursor
gobject.set_cursor_from_name(Some("pointer"));
// @TODO Show tooltip
// Show tooltip
gobject.set_tooltip_text(Some(uri.to_string().as_str()));
return;
}
}
}
// Restore default cursor
// Restore defaults
gobject.set_cursor_from_name(Some("text"));
gobject.set_tooltip_text(None);
}
}); // @TODO may be expensive for CPU, add timeout?