Closed nathanielevan closed 3 years ago
From the wiki:
If an already selected file doesn't have the + symbol before it (say, on a directory refresh or after navigating away and back to the dir), the selection toggle key will add it again.
This is the intended behavior.
Hi,
I also stumbled over this behavior and find it not intuitive from a user's perspective.
So it is a good that it is properly documented! However, @KlzXS can you elaborate why this behavior is intended, and selected files are not just marked with the + again even after directory navigation/refresh or a redraw?
BR, Alex
can you elaborate why this behavior is intended
Because of the theoretical maximum memory requirement to remember all selected files. Please refer to commit 547d87bfc2caf276dd1bcb943677a0ca306c602d.
I also stumbled over this behavior and find it not intuitive from a user's perspective.
There are good file managers which limit selection within the same directory. Check out one of those.
nnn
has many users on mid-range Android devices or boards like the Pi. Desktop users are not our primary concern. So we keep a tab on memory usage, performance and disk IO. If these are not your primary concern and a behaviour in nnn
bothers you, you should try a different file manager that suits your needs.
Marking them again after re-entering of redrawing would require checking for each drawn file if it is in the selection. That is a lot of string comparisons and is not the cheapest of actions.
The same argument holds for why files can be selected multiple times. It's expensive to check files agains the selection.
There may be a way to create a fast way of checking using something like a hash table, but that would require extra memory usage. Which nnn
tries to avaid if not necessary, since it also targets systems with low resources.
@jarun maybe this can be another user patch like the Miller columns, when that becomes a thing. What do you think?
maybe this
If you mean the patch, the memory usage is huge when it comes to supporting even 2 filesystems.
Maybe this
as in a general patch to solve this problem. Can be your hashbit attempt, can be something else.
Also help me understand "huge". If I'm reading the commit properly the required memory is around HASH_OCTETS << 3
bytes, which I think translates to 2MB, per fs. Now I understand that's some say 66% of memory it usually uses on my system, but I wouldn't consider that huge. After all the browser I'm viewing this in uses up about 1000 times more.
I'm not saying add it by default. I just think it might be worth including it next to Miller columns when/if that happens.
huge
That one was experimental. Inode number length in ext4 is 8 bytes. So to be accurate HASH_BITS would be 0xFFFFFFFFFFFFFFFF. So you need (2^256) and then comes multiple filesystems. Yes, we can try a more efficient polynomial hashing algo but I don't see the need for it given no other file manager does this today and:
I am familiar with the design choice of a smartphone UI where they exposed the SMS channels for the users to tweak easily. It was a disaster because users would make the config bad and complain it's the problem with the mobile. I see the same pattern here.
That one was experimental. Inode number length in ext4 is 8 bytes. So to be accurate HASH_BITS would be 0xFFFFFFFFFFFFFFFF.
Fair enough. There you have it folks, the reason.
nnn
has many users on mid-range Android devices or boards like the Pi. Desktop users are not our primary concern. So we keep a tab on memory usage, performance and disk IO. If these are not your primary concern and a behaviour innnn
bothers you, you should try a different file manager that suits your needs.
Chiming in to let you know: I consider the desktop to be one of the primary candidates for nnn
. Though What is more important to me is that it will work on any of the machines I work with, so that my setup is consistent across multiple machines. Thus allowing my "usual" environment to be mobile via ssh/terminals... Infact I haven't launched my GUI file browser this year...
I will uninstall my GUI file browser when I get thumbnails
and drag and drop
working inside nnn
(Both of which require modifying my terminal)
@nathanielevan persistent selection marker is on master now and will be available in the next release. Try it out!
Environment details (Put
x
in the checkbox along with the information)[x] Operating System: Arch Linux [x] Desktop Environment: bspwm, i3 [x] Terminal Emulator: alacritty, st, urxvt [x] Shell: zsh [ ] Custom desktop opener (if applicable): [ ] Program options used: [ ] Configuration options set: [x] Issue exists on
nnn
masterExact steps to reproduce the issue
I select a file by pressing space:![2020-11-23-163120](https://user-images.githubusercontent.com/9361126/99946920-c1dad880-2da9-11eb-86e7-23b0763a5833.png)
Then I visit a different directory, then go back to this directory, the + mark is gone:![2020-11-23-163127](https://user-images.githubusercontent.com/9361126/99946935-c7d0b980-2da9-11eb-880e-dc9156be3559.png)
The file itself is still selected, because I can move it to a different directory, e.g. ~/Documents:![2020-11-23-163307](https://user-images.githubusercontent.com/9361126/99947067-ffd7fc80-2da9-11eb-8d32-5181096b4a76.png)
But instead of moving the file, if I select the same file again, it becomes re-selected and the "select counter"(?) at the bottom of the screen increments:![2020-11-23-163341](https://user-images.githubusercontent.com/9361126/99947626-d8356400-2daa-11eb-89c7-05c773d40919.png)
And if I then move it to a different directory, I get this error:![2020-11-23-163407](https://user-images.githubusercontent.com/9361126/99947820-1df22c80-2dab-11eb-9536-5cf6b04c22b2.png)
The file still gets moved, though:![2020-11-23-163421](https://user-images.githubusercontent.com/9361126/99947851-29455800-2dab-11eb-9554-99689bcf0a3f.png)