diff --git a/yazi-core/src/tab/folder.rs b/yazi-core/src/tab/folder.rs index 8715cc5e..ae88a317 100644 --- a/yazi-core/src/tab/folder.rs +++ b/yazi-core/src/tab/folder.rs @@ -73,7 +73,9 @@ impl Folder { FilesOp::Upserting(_, files) => self.files.update_upserting(files), } + self.trace = self.trace.take_if(|_| !self.files.is_empty() || self.stage.is_loading()); self.repos(self.trace.clone().as_ref().map(|u| u.as_urn())); + (stage, revision) != (self.stage, self.files.revision) } @@ -97,7 +99,7 @@ impl Folder { self.prev(step) }; - self.trace = self.hovered().filter(|_| b).map(|h| h.urn_owned()).or(mem::take(&mut self.trace)); + self.trace = self.hovered().filter(|_| b).map(|h| h.urn_owned()).or(self.trace.take()); b |= self.squeeze_offset(); self.sync_page(false); diff --git a/yazi-core/src/tab/tab.rs b/yazi-core/src/tab/tab.rs index e81a5ce6..204ac733 100644 --- a/yazi-core/src/tab/tab.rs +++ b/yazi-core/src/tab/tab.rs @@ -131,8 +131,10 @@ impl Tab { }; apply(&mut self.current); + if let Some(parent) = &mut self.parent { apply(parent); + parent.hover(self.current.url.urn()); // The parent should always track the CWD } self diff --git a/yazi-fs/src/stage.rs b/yazi-fs/src/stage.rs index 009dd980..a5419bd1 100644 --- a/yazi-fs/src/stage.rs +++ b/yazi-fs/src/stage.rs @@ -8,6 +8,11 @@ pub enum FolderStage { Failed(std::io::ErrorKind), } +impl FolderStage { + #[inline] + pub fn is_loading(self) -> bool { self == Self::Loading } +} + impl Serialize for FolderStage { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(Some(2))?;