I did a quick search and didn't find any mentions of this, but I'm curious if it is possible.
Basically there are times where I am selecting a bunch of various files in a folder, but accidentally mis-click or forget to hold Ctrl, then it all gets unselected.
Is it something that could theoretically be accomplished via a custom script?
There is a Select RESELECT command, but unfortunately it only restores selections cleared by other commands (e.g. Copy), not de-selection via the mouse or Select NONE etc.
Checkbox Mode or Power Mode offer mouse/selection styles where it's harder to accidentally deselect things, which can be nice when building up a big selection. But you have to remember to use them, of course, and I almost never do either. (Or use them all the time, but I'm too used to the way things work normally.)
Scripts can monitor the selection (Dialog.WatchTab with an invisible dialog processing the events) but I don't know how good performance would be if one was saving every selection change in every tab. Which isn't to say it won't work, but it's not something I've tried or measured the impact of.
(BTW, Middle-click can do the same as Ctrl + Left-click if the MMB is set to a standard middle button.)
Ok cool I'll probably try to start using one of those modes if I know I'm going to be selecting a lot. I was also thinking performance might be hit from a continuous script and considered a script that could be enabled/disabled when needed, but sounds like either checkbox or power modes would basically accomplish the same thing.
Yeah, I'd worry about performance, although it could turn out to be fine. Isn't something I've tried.
I haven't looked at how the existing reselect works in a while, but maybe we could have it apply to mouse deselections as well as what it does now. Depends how much extra memory (or looping through files) it'd need, but probably wouldn't be huge.
Although... it still might not help if, instead of clicking the background to deselect everything, you clicked on a file/folder (without ctrl) by mistake, which would de-select everything else but also mean there's now a selection. "Reselect" could go back to the previous selection, but the more I think that through the trickier it is to define a good rule for which selection events can be undone, and which events overwrite the saved selection you'd go back to, which could become quite a fragile piece of state, such as if one file was selected and then another.
(That might be why reselect doesn't work that way already. Not sure though.)