kamiyaa / joshuto

ranger-like terminal file manager written in Rust
https://crates.io/crates/joshuto
GNU Lesser General Public License v3.0
3.47k stars 154 forks source link

Rework file entry representation in “TuiDirListDetailed” #71

Closed DLFW closed 3 years ago

DLFW commented 3 years ago

Unlike ranger, joshuto does not show the size of directories (number of files and dirs inside), and does not show any size information for symlinks. Also, joshuto shows symlinked directories like files and with a wrong devicon.

Two views on the same test directory:

Ranger: ranger_file_view

Joshuto: joshuto_file_view

I would propose to rework joshuto's display to match ranger's. It just makes sense and the "size" of directories is quite useful.

Furthermore, ranger supports multiple (and custom) views (called “linemode”), which I use for example to show tmsu tags for each file and dir. But that's likely worth its own issue.


Edit: One more difference where the ranger variant makes more sense: When a symlink is selected, the footer bar shows the permission flags of the linked target rather those of the symlink itself, which is always lrwxrwxrwx.

I have started an experimental implementation.

kamiyaa commented 3 years ago

👍 Yes, this was something I was aware of, but haven't really found it that annoying so I never got around to it xd.

I believe how ranger does it is, it only shows the number of files/directories inside a folder if and only if the cursor has been on that folder before. I'm guessing this is because previously, the contents of the folder has not been loaded into their data structures.

I'm guessing your implementation would have similar behaviour? Where if the contents of the folder is not loaded in our HashMap, its not displayed.

One more difference where the ranger variant makes more sense: When a symlink is selected, the footer bar shows the permission flags of the linked target rather those of the symlink itself, which is always lrwxrwxrwx.

I never knew this was a thing. Learning something new everyday :)

Furthermore, ranger supports multiple (and custom) views (called “linemode”), which I use for example to show tmsu tags for each file and dir. But that's likely worth its own issue.

Yea, if you could elaborate this on a new issue, that'd be great! I'm not very familiar with ranger's different views.

DLFW commented 3 years ago

I believe how ranger does it is, it only shows the number of files/directories inside a folder if and only if the cursor has been on that folder before.

Nope. It shows them always right from the beginning.


I just recognize that there's a third feature that would fit in this context:

Joshuto doesn't show invalid symlinks. Ranger shows them in a highlighted color, which is pretty useful. Hiding them can even be quite confusing. I just stumbled across such a case myself.

Any concerns?

kamiyaa commented 3 years ago

Nope. It shows them always right from the beginning.

That's odd. My ranger behaves differently. It only shows the directory number after a preview has been generated.

20210620-203122_swappy

Joshuto doesn't show invalid symlinks. Ranger shows them in a highlighted color, which is pretty useful. Hiding them can even be quite confusing. I just stumbled across such a case myself.

Off the top of my head, I'm thinking we can change theme.toml (and its necessary code) to have an option for broken links. Don't think this is high priority though.

EDIT: another pic 20210620-203515_swappy

DLFW commented 3 years ago

That's really strange.... I cannot remember that I did something for this in my config to work...

kamiyaa commented 3 years ago

That's really strange.... I cannot remember that I did something for this in my config to work...

My suspicion is this option:

# Automatically count files in the directory, even before entering them?
set automatically_count_files true
DLFW commented 3 years ago

Yeah, sounds like a good guess. But it seems to be the default: https://github.com/ranger/ranger/blob/8181077f3b0afc7b6258a85d3a03b7bce23d316c/ranger/config/rc.conf#L52

kamiyaa commented 3 years ago

Can this be closed? Or is there furthur work to be done?

DLFW commented 3 years ago

The special representation of dangling symlinks is missing and was mentioned in here as a side-thing. But I'm also fine with closing it. I won't forget that one. :wink:

kamiyaa commented 3 years ago

Closed via #80