eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
12.5k stars 220 forks source link

fix(tree-view): Ensure nested tree parts align under item name #1193

Closed bew closed 1 month ago

bew commented 1 month ago

Before:

foo/
├── nested/
│  ├── bar
│  └── other-bar
└── baz

Notice how the nested tree is aligned on the blank before the dir name

After:

foo/
├── nested/
│   ├── bar
│   └── other-bar
└── baz

Now the nested tree is aligned on the dir name, making it much nicer to look at and more logical.

Closes #984

👉 Review only the first commit (+44 -60 changes) The second commit is an update (just idump) of the generated test files (+25k -25k changes)

❔ Can I avoid committing the generated test files? This makes look like this is a HUGE PR when it's actually not... 🤔 It looks like I need to have that commit for the Nix Flake Check to pass on Github Actions


The ascii_art function for TreePart is used 2 times: https://github.com/eza-community/eza/blob/d1df86e9694cb7320958b5c5d31b0086b2545af7/src/output/details.rs#L505 https://github.com/eza-community/eza/blob/d1df86e9694cb7320958b5c5d31b0086b2545af7/src/output/details.rs#L534 For some reason the extra_width (2nd) param of TextCell::push was already set to 4 even though the previous pushed text was really 3 in width 🤔 So nothing to change here.

bew commented 1 month ago

@cafkafk Looks like it's working well: image