Skip to content

fix: -t draws the (others) row out of size order - #615

Merged
bootandy merged 1 commit into
bootandy:masterfrom
VXNCXNX:fix/others-row-sort-order
Aug 18, 2026
Merged

fix: -t draws the (others) row out of size order#615
bootandy merged 1 commit into
bootandy:masterfrom
VXNCXNX:fix/others-row-sort-order

Conversation

@VXNCXNX

@VXNCXNX VXNCXNX commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

With -t, the aggregated (others) row is appended after the list is sorted, so when its total is larger than the rows above it the tree comes out in the wrong order and the "biggest" highlight lands on the wrong row.

Four files of 40Ki, 30Ki, 20Ki and 10Ki, shown with -t -n 2:

before    64Ki   ┌── (others)
          40Ki   ├── .bin          <- 40Ki drawn below 64Ki
         104Ki ┌─┴ (total)

after     40Ki   ┌── .bin
          64Ki   ├── (others)
         104Ki ┌─┴ (total)

The after order matches how dust draws a normal listing, where the largest sits nearest the total. The list is re-sorted once the (others) node has been pushed, inside the branch that creates it, so output without an (others) row is unchanged.

Test added in src/filter_type.rs; removing the sort fails it. cargo test passes, 33 plus 8 plus 31 plus 4. cargo fmt --check clean; the 4 clippy warnings in tests/ are pre-existing and identical on an unmodified checkout.

AI disclosure: written with Claude Code. I ran the binary before and after and checked the mutation myself.

@bootandy
bootandy merged commit 8a846f6 into bootandy:master Aug 18, 2026
19 checks passed
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.

2 participants