5820K and GTX970
Latest daily build (but same problem in earlier ones too)
Short description of error
I have a modal operator which uses image_paint function.
After using it, if I do an undo, I would expect all paint operations during modal operation to be undone.
However every call to image_paint adds another item to the undo list which means I have to undo through every mouse move.
If I have moved the mouse more than (max undo items) then I can't get back to the position before I started the operator at all (making the undo pointless)
This doesn't seem to be the consistent with other modal operator. For example, in the docs [[ URL | https://docs.blender.org/api/blender_python_api_current/bpy.types.Operator.html ]] the modal excecution example (with the addition of UNDO added to bl_options) moves a cube. Many changes can be made to the position of the cube during the modal operation. However one undo (correctly in my option) puts the cube back in the original place before the operator is run.
I did try using UNDO_GROUPED in my bl_options as well as UNDO - neither worked.
If I am doing something wrong or stupid in my code - sorry!
Exact steps for others to reproduce the error
Load the attached scene.
Press Run Script
Hover over cube.
Type in Simple Paint Operator <return> to activate operator
Press mouse button to stop the operator
Try Undoing - it undo things one mouse move at a time