-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds keybinding for 'm' to toggle sorting by modified time #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding such a huge feature - t's much appreciated!
I'd expect the performance to remain roughly the same as metadata is already queried anyway. The only difference should be memory consumption as the mtime field has been added.
Besides that, I'd love to retain the initial cleanness of the GUI, and start with the mtime
column hidden. This can probably be implemented by adding another state to the sorting toggle.
- initial state: mtime hidden
- press m: sort by mtime ascending
- press m: sort by mtime descending
- press m: mtime hidden
Does that make sense?
Thanks for your consideration.
3dbecac
to
c66d236
Compare
c66d236
to
0f8377a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for applying the requested changes.
I left a note regarding the size of the structure, if you could have a look.
Further, I ran the program and love that the mtime column now starts hidden. However, I'd expect it to cycle through the hidden state as well, and right now there is no way to get to the original, hidden, state anymore. Was this intentional, and if so what's the rationale?
Thanks again for your help in getting this feature implemented.
The way to hide the mtime column is to sort by size. You press 'm' to sort by mtime, and press 's' to sort by size. If you keep pressing 'm' or 's' you just cycle between ascending / descending. My rationale is that if the user wants to sort by mtime then that column should be visible. |
Thanks for the explanation, that also makes sense and I think it's enough to wait for feedback from users. My guess is that it can stay as is as well. ![]() The above is a screenshot of After trying the same with this branch, I got a crash (wait for it :D):
It crashes in the standard library which isn't able to deal with timestamps before 1970 with nanoseconds on MacOS. Yes, it's true, and it will panic then. Fortunately, this was already fixed and will be available in Rust 1.75. This should just mean I have to hold back with creating a new release until then. Let's hope I remember. Anyway, a nightly build produced a working binary on MacOS, and here is the outcome: Thus nothing changed beyond a rounding error, both in terms of performance or in terms of memory consumption. Good to go 😊👍 |
Nice find! I have learned something new, thanks for sharing. I know this PR has already landed, but let's keep an option of reverting it and keeping it on a branch until Rust 1.75 is released. |
Adds keybinding for 'm' to toggle sorting by modified time. Additionally appropriate column is highlighted depending on if sorting is by time or by size + mtime column is hidden by default.
Sorting by modified time + current sorting mode in the footer:
![Screenshot 2023-11-23 at 22 59 52](https://private-user-images.githubusercontent.com/697414/285320728-478687e1-b86b-44ad-8e30-796819ad44bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTU5MjQsIm5iZiI6MTczOTM1NTYyNCwicGF0aCI6Ii82OTc0MTQvMjg1MzIwNzI4LTQ3ODY4N2UxLWI4NmItNDRhZC04ZTMwLTc5NjgxOWFkNDRiZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMDIwMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNTk0MGUxZTViZmNhMjFkZDZlYjYwZDAxYmNiYjAwZDVjZGE3ZTlhMmJiNTBiMTllZjJhYTUxNGRlODM2MjhhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.l0RjXwGE9xhN_IniBfRUol2Bs32C1zcsscSUmMzMNuY)
Help:
![Screenshot 2023-11-23 at 23 00 08](https://private-user-images.githubusercontent.com/697414/285320818-bde6c190-f39d-4f95-acb7-0d4f5989fe69.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTU5MjQsIm5iZiI6MTczOTM1NTYyNCwicGF0aCI6Ii82OTc0MTQvMjg1MzIwODE4LWJkZTZjMTkwLWYzOWQtNGY5NS1hY2I3LTBkNGY1OTg5ZmU2OS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMDIwMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lZDhiOTUzNjBmYjQ4YzQ1NTM4NmI0NzIwMTQ3ZWFkYzA3NjgzYjJmNzc2NzI1ZmJmYzRiZmI4NGIzYjI3NmMwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.D_Odrrop7rTQoAqDT3WIOa-C88gBQNgP9YWRqLP_Y1E)
Addresses issue #141