This commit is contained in:
sxyazi 2025-01-18 22:38:34 +08:00
parent de932e66b5
commit d5f4cd7c2e
No known key found for this signature in database
5 changed files with 10 additions and 6 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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<impl AsRef<Urn>>) -> bool {
if let Some(u) = url { self.hover(u.as_ref()) } else { self.arrow(0) }
}
pub fn sync_page(&mut self, force: bool) {

View file

@ -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);

View file

@ -55,6 +55,10 @@ impl Borrow<Urn> for UrnBuf {
fn borrow(&self) -> &Urn { Urn::new(&self.0) }
}
impl AsRef<Urn> for UrnBuf {
fn as_ref(&self) -> &Urn { self.borrow() }
}
impl AsRef<Path> for UrnBuf {
fn as_ref(&self) -> &Path { &self.0 }
}