From d5f4cd7c2e2afd35a87c926838b993146e4b1eee Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 18 Jan 2025 22:38:34 +0800 Subject: [PATCH] .. --- yazi-core/src/manager/commands/hover.rs | 2 +- yazi-core/src/tab/commands/filter_do.rs | 2 +- yazi-core/src/tab/folder.rs | 6 +++--- yazi-core/src/tab/tab.rs | 2 +- yazi-shared/src/url/urn.rs | 4 ++++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/yazi-core/src/manager/commands/hover.rs b/yazi-core/src/manager/commands/hover.rs index c620779b..e6c34db0 100644 --- a/yazi-core/src/manager/commands/hover.rs +++ b/yazi-core/src/manager/commands/hover.rs @@ -26,7 +26,7 @@ impl Manager { if let Some(u) = opt.url { self.hover_do(u, opt.tab); } else { - self.current_or_mut(opt.tab).repos(None); + self.current_or_mut(opt.tab).arrow(0); } // Repeek diff --git a/yazi-core/src/tab/commands/filter_do.rs b/yazi-core/src/tab/commands/filter_do.rs index 44606628..d8065776 100644 --- a/yazi-core/src/tab/commands/filter_do.rs +++ b/yazi-core/src/tab/commands/filter_do.rs @@ -25,7 +25,7 @@ impl Tab { return; } - self.current.repos(hovered.as_ref().map(|u| u.as_urn())); + self.current.repos(hovered.as_ref()); if self.hovered().map(|f| f.urn()) != hovered.as_ref().map(|u| u.as_urn()) { ManagerProxy::hover(None, self.id); } diff --git a/yazi-core/src/tab/folder.rs b/yazi-core/src/tab/folder.rs index ae88a317..8aa82805 100644 --- a/yazi-core/src/tab/folder.rs +++ b/yazi-core/src/tab/folder.rs @@ -74,7 +74,7 @@ impl Folder { } 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())); + self.repos(self.trace.clone()); (stage, revision) != (self.stage, self.files.revision) } @@ -116,8 +116,8 @@ impl Folder { } #[inline] - pub fn repos(&mut self, url: Option<&Urn>) -> bool { - if let Some(u) = url { self.hover(u) } else { self.arrow(0) } + pub fn repos(&mut self, url: Option>) -> bool { + if let Some(u) = url { self.hover(u.as_ref()) } else { self.arrow(0) } } pub fn sync_page(&mut self, force: bool) { diff --git a/yazi-core/src/tab/tab.rs b/yazi-core/src/tab/tab.rs index 204ac733..2e9b083e 100644 --- a/yazi-core/src/tab/tab.rs +++ b/yazi-core/src/tab/tab.rs @@ -127,7 +127,7 @@ impl Tab { f.files.set_sorter(<_>::from(&self.pref)); render!(f.files.catchup_revision()); - render!(f.repos(f.trace.clone().as_ref().map(|u| u.as_urn()))); + render!(f.repos(f.trace.clone())); }; apply(&mut self.current); diff --git a/yazi-shared/src/url/urn.rs b/yazi-shared/src/url/urn.rs index 0d717ced..050ea500 100644 --- a/yazi-shared/src/url/urn.rs +++ b/yazi-shared/src/url/urn.rs @@ -55,6 +55,10 @@ impl Borrow for UrnBuf { fn borrow(&self) -> &Urn { Urn::new(&self.0) } } +impl AsRef for UrnBuf { + fn as_ref(&self) -> &Urn { self.borrow() } +} + impl AsRef for UrnBuf { fn as_ref(&self) -> &Path { &self.0 } }