This commit is contained in:
sxyazi 2025-01-18 22:34:01 +08:00
parent d022983830
commit de932e66b5
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
use std::{collections::HashSet, path::PathBuf}; use std::collections::HashSet;
use yazi_dds::Pubsub; use yazi_dds::Pubsub;
use yazi_macro::render; use yazi_macro::render;
@ -50,16 +50,8 @@ impl Manager {
} }
fn hover_do(&mut self, url: Url, tab: Option<Id>) { fn hover_do(&mut self, url: Url, tab: Option<Id>) {
// Hover on the file if let Ok(p) = url.strip_prefix(&self.current_or(tab).url) {
if let Ok(p) = url.strip_prefix(&self.current_or(tab).url).map(PathBuf::from) { render!(self.current_or_mut(tab).hover(Urn::new(p)));
render!(self.current_or_mut(tab).repos(Some(Urn::new(&p))));
}
// Turn on tracing
if self.current_or(tab).hovered().is_some_and(|h| h.url == url) {
// `hover(Some)` occurs after user actions, such as create, rename, reveal, etc.
// At this point, it's intuitive to track the location of this file regardless.
self.current_or_mut(tab).trace = Some(url.urn_owned());
} }
} }
} }