mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
ab27c7a069
commit
0967a701f9
4 changed files with 13 additions and 9 deletions
|
|
@ -35,7 +35,7 @@ impl<'a> Widget for Left<'a> {
|
|||
|
||||
if let Some(h) = &manager.hovered {
|
||||
// Length
|
||||
if let Some(len) = h.length {
|
||||
if let Some(len) = h.length() {
|
||||
spans.push(Span::styled(format!(" {} ", readable_size(len)), body.bg().fg(**primary)));
|
||||
spans.push(Span::styled(&separator.closing, body.fg()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use tokio::fs;
|
|||
pub struct File {
|
||||
pub(super) path: PathBuf,
|
||||
pub(super) meta: Metadata,
|
||||
pub length: Option<u64>,
|
||||
pub(super) length: Option<u64>,
|
||||
pub link_to: Option<PathBuf>,
|
||||
pub is_link: bool,
|
||||
pub is_hidden: bool,
|
||||
|
|
@ -55,4 +55,8 @@ impl File {
|
|||
|
||||
#[inline]
|
||||
pub fn is_dir(&self) -> bool { self.meta.is_dir() }
|
||||
|
||||
// --- Length
|
||||
#[inline]
|
||||
pub fn length(&self) -> Option<u64> { self.length }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ impl FilesSorter {
|
|||
}),
|
||||
SortBy::Natural => self.sort_naturally(items),
|
||||
SortBy::Size => items.sort_unstable_by(|a, b| {
|
||||
self.cmp(a.length.unwrap_or(0), b.length.unwrap_or(0), self.promote(a, b))
|
||||
self.cmp(a.length().unwrap_or(0), b.length().unwrap_or(0), self.promote(a, b))
|
||||
}),
|
||||
}
|
||||
true
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ impl Tasks {
|
|||
}
|
||||
|
||||
let targets: Vec<_> =
|
||||
targets.iter().filter(|f| f.is_dir() && f.length.is_none()).map(|f| f.path()).collect();
|
||||
targets.iter().filter(|f| f.is_dir() && f.length().is_none()).map(|f| f.path()).collect();
|
||||
|
||||
if !targets.is_empty() {
|
||||
self.scheduler.precache_size(targets);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue