Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,26 @@ always come first. The preview window walks a folder in the order the list shows
and Save dialogs from other apps read and save the same orders. The orders are kept in
`$XDG_STATE_HOME/gannet/sorts`, which is `~/.local/state/gannet/sorts` by default.

A folder's Size says how many items it holds: "8 items", "1 item", "Empty", or "10,000+ items",
where counting stops. Hidden items count only while hidden files show. A folder of more than
100,000 entries, nearly all hidden, is read only that far: it says how many that show it found,
as "3+ items", and sorts by that. Only folders on screen are counted, on a thread of their own after
the rows show, so opening a folder is no slower. Each folder on screen is watched once counted,
so a change in it counts it again, a moment later; one that keeps changing is counted at most
every 2 seconds. Sorting by size counts every folder, fullest first, without watching them; each
is watched when it comes on screen, and read again then only if it changed. Reading a folder
again keeps the counts it had and reads again only the folders that changed. A folder counts as
unchanged when its disk, inode, and modified and changed times (mtime and ctime) are as they
were, and both times were at least 2 seconds old when it was counted, for disks that keep times
only to the second; a program can set the modified time back, but not the changed time. A folder of more
than 1,024 folders watches the first 1,024 it shows; past that, or past the system's limit on
watches, a count isn't kept up to date until there's room for a watch when it's on screen again,
or the folder is read again. A count wider than the Size column, as "10,000+ items" is, reaches
to its left, and the name beside it is cut short of it; a rename field there keeps room to type,
covering the count if it must. Folders on network places (SMB, SFTP, FTP,
NFS, WebDAV and other FUSE mounts), and links that lead into one, aren't counted, as each count
would be a round trip, and their Size stays blank.

## Dragging

Drag files onto a folder in the list or a place in the sidebar. Dragging one selected item
Expand Down
12 changes: 7 additions & 5 deletions crates/app/src/a11y.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ pub struct Rows {
pub columns: Vec<Col>,
/// The column the list is sorted by, and whether it's in descending order.
pub sort: (Column, bool),
/// Whether hidden files show, which a folder's count of items follows.
pub show_hidden: bool,
}

/// One of the file list's columns.
Expand Down Expand Up @@ -382,7 +384,7 @@ impl PartialEq for Rows {
(None, None) => true,
_ => false,
};
self.era == o.era && same_listing && Arc::ptr_eq(&self.order, &o.order) && Arc::ptr_eq(&self.selected, &o.selected) && Arc::ptr_eq(&self.cut, &o.cut) && self.area == o.area && self.row_h == o.row_h && self.scroll == o.scroll && self.columns == o.columns && self.sort == o.sort
self.era == o.era && same_listing && Arc::ptr_eq(&self.order, &o.order) && Arc::ptr_eq(&self.selected, &o.selected) && Arc::ptr_eq(&self.cut, &o.cut) && self.area == o.area && self.row_h == o.row_h && self.scroll == o.scroll && self.columns == o.columns && self.sort == o.sort && self.show_hidden == o.show_hidden
}
}

Expand Down Expand Up @@ -413,14 +415,14 @@ impl Rows {
Some(if l.search().is_some() { crate::app::search_location(folder, &self.here.dir, &self.here.title) } else { crate::app::home_location(folder, self.here.home.as_deref()) })
}

/// What a row's cell in a column says, as the list shows it. A folder has no size, and a
/// file not looked at yet has none of either.
/// What a row's cell in a column says, as the list shows it. A folder's size is how many
/// items it holds, and a row not looked at yet has none of either.
pub fn cell(&self, entry: u32, column: Column, now: i64) -> String {
let Some(l) = self.listing.as_deref().filter(|l| (entry as usize) < l.len()) else { return String::new() };
match (column, l.stat(entry)) {
(Column::Name, _) => self.name(entry),
(Column::Location, _) => self.location(entry).unwrap_or_default(),
(Column::Size, Stat::Known { size, .. }) if !matches!(l.kind(entry), Kind::Dir | Kind::LinkDir) => crate::format::size(size),
(Column::Size, _) => crate::format::size_cell(l, entry, self.show_hidden),
(Column::Modified, Stat::Known { mtime, .. }) => crate::format::date(mtime, now),
(Column::Modified, Stat::Failed) => "unknown".into(),
_ => String::new(),
Expand Down Expand Up @@ -849,7 +851,7 @@ impl Link {
SortKey::Size => Column::Size,
SortKey::Modified => Column::Modified,
};
let rows = Rows { era: self.era, listing: app.listing.clone(), order, index, selected, cut: app.cut_paths.clone(), area: l.list, row_h: l.row_h.max(1), scroll: app.scroll, here: self.here.clone(), columns: columns(app, &l), sort: (column, sort.descending) };
let rows = Rows { era: self.era, listing: app.listing.clone(), order, index, selected, cut: app.cut_paths.clone(), area: l.list, row_h: l.row_h.max(1), scroll: app.scroll, here: self.here.clone(), columns: columns(app, &l), sort: (column, sort.descending), show_hidden: app.show_hidden };

let place_h = app.place_h();
let places: Vec<Node> = app.places.iter().enumerate().map(|(i, p)| {
Expand Down
Loading
Loading