Bug 402263

Summary: Undoing doesn't always set document back to "not modified"
Product: [Applications] krita Reporter: Rebecca Breu <rebecca>
Component: GeneralAssignee: vanyossi <ghevan>
Status: RESOLVED FIXED    
Severity: normal CC: freebox64, halla
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot of asterisk and undo history

Description Rebecca Breu 2018-12-17 22:44:26 UTC
Undoing certain image operations does correctly undo the operation, but doesn't recognise when the image is back in its saved state; asterisk remains.


STEPS TO REPRODUCE
1. Create an image and save it: No asterisk in title bar, as expected
2. Perform any one of the following operations: "Scale Image To New Size", "Resize Canvas", any of the selection tools (and possibly others?)
3. Hit "Undo": Image is back in its original state, but there's still the asterisk in the title bar and hitting "Save" will trigger a save.

EXPECTED RESULT
If undoing lands me on the image's saved version, the asterisk should disappear. This works for example with brush strokes and undoing them, the transform tool and the move tool.


ADDITIONAL INFORMATION

Tested on the nightly app image 6e6e71e-x86_64 from Dec 14.
Comment 1 Rebecca Breu 2018-12-17 22:45:25 UTC
Created attachment 116975 [details]
Screenshot of asterisk and undo history
Comment 2 mvowada 2018-12-17 23:23:02 UTC
Confirming (Krita 4.2.0-pre-alpha (git 95b09ea) - Ubuntu 14.04).

(See also Bug 386488)
Comment 3 vanyossi 2019-05-21 06:06:59 UTC
Hi, I tested and many tools do this. in two categories. 

Restore the "no asterisk" and then turn it on again:
Resize canvas
Resize Image
Crop
Offset Image
Shear
Rotate
Smart patch tool
Fill
Applying a GMiC filter

Does not restore the "no asterik" state
All selections
Comment 4 vanyossi 2019-06-23 05:18:41 UTC
Git commit 420635d117eb03fc124749f5acb414e3db33996d by Ivan Yossi.
Committed on 23/06/2019 at 05:17.
Pushed by ivany into branch 'master'.

Fix undo/redo not restoring clean state.

Only set image as modified if the undo index is not in the
clean state.

M  +2    -1    libs/ui/KisDocument.cpp

https://invent.kde.org/kde/krita/commit/420635d117eb03fc124749f5acb414e3db33996d
Comment 5 Halla Rempt 2019-06-24 08:21:44 UTC
Git commit 8428f5044d03337f3270bf70c804e95bc9af58a2 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 24/06/2019 at 08:20.
Pushed by rempt into branch 'krita/4.2'.

Fix undo/redo not restoring clean state.

Only set image as modified if the undo index is not in the
clean state.

M  +2    -1    libs/ui/KisDocument.cpp

https://invent.kde.org/kde/krita/commit/8428f5044d03337f3270bf70c804e95bc9af58a2