Skip to content

Filter the mosaic by kind of data and by file size - #97

Open
armada45-pixel wants to merge 1 commit into
tobi:mainfrom
armada45-pixel:filter-kind-size
Open

armada45-pixel wants to merge 1 commit into
tobi:mainfrom
armada45-pixel:filter-kind-size

Conversation

@armada45-pixel

@armada45-pixel armada45-pixel commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

One of a set of small PRs that replace #87 and #88, one feature each. Rebased onto 1.5.0 (73bdbb3); they touch neighbouring lines in state.rs, views.rs and tests.rs, so whichever merges later will need another rebase; I'll do those as they come up.

The only way to narrow the mosaic is a name typed after /, which cannot ask for "the caches" or "files over a gigabyte". This adds two buttons beside the scan totals.

  • Name opens the field / already opens.
  • Filter opens a menu:
    • Tick any number of kinds: Code, Agent scratch, Toolchains, Synced, Git, Media, Documents, Cache.
    • Give a Min and a Max file size on one line. Each is a text field with a "No limit" placeholder, a cross that empties it, and its own unit dropdown (KiB, MiB, GiB, TiB).
    • The button counts what is in force ("3 on"), and the menu reads it back as a sentence ("Showing Code or Media, from 10 MiB to 2.0 GiB").
    • A bad size is said under the fields with an icon and a sentence, and Apply (never disabled) puts the keyboard in the field that is wrong.

How it works. The menu's choices travel to the search as words in the same needle as the name (kind:cache, >bytes, <bytes), parsed by a new filter::Query, so Name and Filter combine and the filtered layout is unchanged. A word that only looks like a kind or a size stays in the name. A size is asked of files only; a kind takes the topmost directory of that kind whole. Esc in the Name field drops the name alone.

Accessibility. The menu is laid out to the POUR principles: nothing smaller than body text; a state is never colour alone; every control is a tab stop at least 32 px tall. It is a focus scope that opens with the keyboard in the Min field: Tab and Shift+Tab walk it, Space ticks, Enter applies, Esc closes. The controls are the toolkit's own checkbox, select, input and button, so each carries a role and a name.

This is the largest of the set (about 1,450 lines, of which 560 are tests).

Verified. cargo xtask lint is green on Windows and all 104 disktree-app tests pass. 9 tests in disktree-cli, disktree-core and disktree-scanner (btrfs, hardlink and cache tests) fail on Windows on an unchanged 1.5.0 too, so the full cargo xtask test run is red there for reasons outside this PR. The core filter tests pass too.

Since 1.5.0. The menu's choices live in the new find_machine beside the typed name: ticking a kind or changing a size searches again, and Esc in the name field drops only the name.

Not verified. Nothing was run on Linux or macOS. On this branch the feature was exercised through the window-harness tests only; the app was not launched from it. No screen reader was tried.

🤖 Generated with Claude Code

The only way to narrow the mosaic was a name typed after `/`, which
cannot ask for "the caches" or "files over a gigabyte". Beside the scan
totals there are now two buttons. Name opens the field `/` opens. Filter
opens a menu: tick any number of kinds, and type a Min and a Max file
size, each with its own unit up to the terabyte and a cross that empties
it.

The menu's choices travel to the search as words in the same needle the
name does (`kind:cache`, `>bytes`, `<bytes`), so the two combine and the
filtered layout needs nothing new. They are held apart from the typed
name, so the field shows only what was typed and Esc there drops the
name alone. A size is asked of files only: a directory is as large as
everything in it, so every directory above a large file would match.

The find state machine carries the menu's words beside the typed query:
`Choose` searches again with new words and applies, `ClearQuery` drops
the name alone, and `Clear` drops both. When only the menu's words were
searched and nothing matched, the field stays shut and everything stays
shown, since there is nothing typed to edit.

The menu is a focus scope that opens with the keyboard in the Min field:
Tab walks it, Space ticks, Enter applies, Esc closes. A bad size is said
under the fields and Apply puts the keyboard in the one that is wrong.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant