Following a discussion on IRC I decided to submit this as an issue.
Describe the bug
Ranged selection (shift+click) can be started from an image that is not in the current collection (but still selected). This can cause unintentionally selecting (and modifying) hundreds of images, which is not user friendly.
To Reproduce
Expected behavior
Only the image clicked in step 4 is selected, and can be used as the start of a new ranged (shift+click) selection.
Platform
Other comments
I guess this issue can also be formulated in a broader sense: Images stay selected when no longer in the current collection. This can be intended behaviour, but I think this is not intuitive.
On IRC, the following possible solutions were proposed.
For me, the most intuitive solution would be: Select the next image when an image is removed. On switching collections, reset the selection (unless the old image is also in the new collection).
Due to how selection is rather persistent in darktable's lighttable here's how IMO should it work:
"Adding to selection automagically is asking for problems" is a good point, so I think your summary of what should happen makes sense.
Also pinging @elstoc because he had an opinion on it as well.
I agree with @johnny-bit's summary. Most of the time selection (of images in the current collection but off-screen) is overridden by mouseover so I can't think of any issues. There are security options to warn when performing certain activities and I suppose there is an argument for adding another security option like "warn when applying changes to more than X images", which would prevent accidental rejection or rating of hundreds of images at once.
This issue did not get any activity in the past 30 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.
Pinging @AlicVB - if you have time can you please look at this one :)
Fully agree here, it's definitely not wanted ! and sorry to have skipped this bug when coming back from holiday...
I think the simpler way to do that is to implement that at the collection level, just before raising the collection changed signal.
At this point, we just have to ensure that all image in selection are still in collection, otherwise we remove them from selection.
That way we don't have "invisible" selected image, and we don't loose the remaining selection either...
I'll have a look
ok, I've look to the code, and it appears that the selected image list seems correctly updated after each collection change. The problem seems to be in how range selection works itself.
I'll propose a fix soon, but the good news at least is that I don't think you can really get selected images outside the current visible collection :)