Selection actions are considered to be file modifications
Environment/Versions
- GIMP version: 2.10.28
- Package:
extra/gimp 2.10.28-1
(Arch Extra repository) - Operating System: Linux
Description of the bug
If I open a file and draw a selection with the Rectangle Select, Ellipse Select, Free Select, Scissor Select, Fuzzy Select or Select By Colour tools, then GIMP marks the file as modified. When I then try to close the document I get a confirmation asking me whether I want to save the image, despite it not actually having been modified in any way. This is a confusing as I have to stop and think carefully each time whether I actually made any changes or not.
(This probably also affects Foreground Select but that hangs on my machine.)
I think, for a better user experience, GIMP should ignore selection actions when determining if the image has changed. Using the eye-dropper, for example, does not cause GIMP to consider the image as modified (though I assume this is because the eye-dropper does not add any entry to the undo history).
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Open any image
- Make a selection using any of the selection tools
Expected result: GIMP reports the image as unmodified
Actual result: GIMP reports the image as modified
Additional information
Implementation suggestions
I assume the reason for the behaviour is that GIMP is looking to see whether there is an item in the undo buffer when determining if the image is modified. I think it should, instead, look at the entire undo history, filter out selection actions and see if there are any items, i.e. in pseudo-code undoHistory.Where(a => !a.IsSelectAction()).Any()
. This would obviously only work if the undo history is infinite.
To solve a finite undo history a dirty flag could be added to the document: the image would be considered modified if the dirty flag is set or there are modifying actions in the undo buffer. The first time a modifying (non-selection) item overflows the undo buffer the dirty flag would be set, as it is then impossible to undo enough to get back to a clean state.