mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
revert url_owned
This commit is contained in:
parent
46f8216831
commit
e7a683ef9d
5 changed files with 13 additions and 10 deletions
|
|
@ -42,7 +42,10 @@ impl File {
|
||||||
pub fn url(&self) -> &Url { &self.url }
|
pub fn url(&self) -> &Url { &self.url }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn url_mut(&mut self) -> &mut Url { &mut self.url }
|
pub fn url_mut(&mut self) -> &mut Url { &mut self.url }
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn url_owned(&self) -> Url { self.url.clone() }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn name(&self) -> Option<&OsStr> { self.url.file_name() }
|
pub fn name(&self) -> Option<&OsStr> { self.url.file_name() }
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ impl Files {
|
||||||
self.items.iter().any(|f| !self.selected.contains(&f.url))
|
self.items.iter().any(|f| !self.selected.contains(&f.url))
|
||||||
};
|
};
|
||||||
|
|
||||||
self.selected = self.iter().map(|f| f.url().to_owned()).collect();
|
self.selected = self.iter().map(|f| f.url_owned()).collect();
|
||||||
b
|
b
|
||||||
}
|
}
|
||||||
Some(false) => {
|
Some(false) => {
|
||||||
|
|
@ -106,7 +106,7 @@ impl Files {
|
||||||
if self.selected.contains(&item.url) {
|
if self.selected.contains(&item.url) {
|
||||||
self.selected.remove(&item.url);
|
self.selected.remove(&item.url);
|
||||||
} else {
|
} else {
|
||||||
self.selected.insert(item.url().to_owned());
|
self.selected.insert(item.url_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
!self.items.is_empty()
|
!self.items.is_empty()
|
||||||
|
|
@ -116,7 +116,7 @@ impl Files {
|
||||||
|
|
||||||
pub fn select_index(&mut self, indices: &BTreeSet<usize>, state: Option<bool>) -> bool {
|
pub fn select_index(&mut self, indices: &BTreeSet<usize>, state: Option<bool>) -> bool {
|
||||||
let mut applied = false;
|
let mut applied = false;
|
||||||
let paths: Vec<_> = self.pick(indices).iter().map(|f| f.url().to_owned()).collect();
|
let paths: Vec<_> = self.pick(indices).iter().map(|f| f.url_owned()).collect();
|
||||||
|
|
||||||
for path in paths {
|
for path in paths {
|
||||||
applied |= self.select(&path, state);
|
applied |= self.select(&path, state);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ impl Finder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.matched.insert(file.url().to_owned(), i);
|
self.matched.insert(file.url_owned(), i);
|
||||||
if self.matched.len() > 99 {
|
if self.matched.len() > 99 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ impl Folder {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn hover_repos(&mut self) -> bool {
|
pub fn hover_repos(&mut self) -> bool {
|
||||||
self.hover(&self.hovered.as_ref().map(|h| h.url().to_owned()).unwrap_or_default())
|
self.hover(&self.hovered.as_ref().map(|h| h.url_owned()).unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hover_force(&mut self, file: File) -> bool {
|
pub fn hover_force(&mut self, file: File) -> bool {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ impl Manager {
|
||||||
|
|
||||||
pub fn yank(&mut self, cut: bool) -> bool {
|
pub fn yank(&mut self, cut: bool) -> bool {
|
||||||
self.yanked.0 = cut;
|
self.yanked.0 = cut;
|
||||||
self.yanked.1 = self.selected().into_iter().map(|f| f.url().to_owned()).collect();
|
self.yanked.1 = self.selected().into_iter().map(|f| f.url_owned()).collect();
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ impl Manager {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
(
|
(
|
||||||
f.url().to_owned(),
|
f.url_owned(),
|
||||||
f.is_dir().then(|| MIME_DIR.to_owned()).or_else(|| self.mimetype.get(f.url()).cloned()),
|
f.is_dir().then(|| MIME_DIR.to_owned()).or_else(|| self.mimetype.get(f.url()).cloned()),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -208,7 +208,7 @@ impl Manager {
|
||||||
return self.bulk_rename();
|
return self.bulk_rename();
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(hovered) = self.hovered().map(|h| h.url().to_owned()) else {
|
let Some(hovered) = self.hovered().map(|h| h.url_owned()) else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -333,7 +333,7 @@ impl Manager {
|
||||||
pub fn update_read(&mut self, op: FilesOp) -> bool {
|
pub fn update_read(&mut self, op: FilesOp) -> bool {
|
||||||
let url = op.url().clone();
|
let url = op.url().clone();
|
||||||
let cwd = self.cwd().to_owned();
|
let cwd = self.cwd().to_owned();
|
||||||
let hovered = self.hovered().map(|h| h.url().to_owned());
|
let hovered = self.hovered().map(|h| h.url_owned());
|
||||||
|
|
||||||
let mut b = if cwd == url {
|
let mut b = if cwd == url {
|
||||||
self.current_mut().update(op)
|
self.current_mut().update(op)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue