I have implemented cancelling and status updates for fill operations. If the fill runs for longer than a set time period, a dialog window appears informing the user of the status of the operation (which stage it is in, how many tiles are filled (if filling), number of tiles to process (morphing, blurring, compositing) and the percentage of completion for the stage. If the user presses escape or the cancel button on the dialog (or closes the dialog), the fill is cancelled pretty much immediately and any changes it had time to do are undone.
I would like feedback/opinions on a couple of issues related to this, one perhaps more technical than the others.
First: how slow is too slow? Half a second? One second? The tricky issue here is to avoid starting the dialog when the time remaining for the fill is too short to even react to it - this is not possible to determine with certainty, except for in the compositing (final) stage (with reasonable error margins). Though harmless, it might be annoying to see a dialog flash.
Secondly: Should a cancelled fill that is not run via a redo command affect the redo stack? Clearly such a fill should not be added to the undo stack - there is nothing to undo, the redo stack is a different issue. Krita clears the redo stack even for cancelled operations. It’s not strictly necessary, but perhaps expected?
The options here (for a cancelled, non redo-run, fill) are:
1: Clear the redo stack and do nothing with it
2: Don’t touch the redo stack, if you reached this point by undoing a bunch of changes, you can still redo them if you cancel the operation.
3: Clear the redo stack and put the cancelled operation on it - this might make sense if you cancelled a long-running op accidentally, but the fill still has to be redone upon running a “redo”.
Personally I favour 1 for consistency, but am interested in other thoughts.
Finally, on a more technical note: Is the Escape-key emergency exit still necessary, and if so , can it be moved to key press instead of key release? This functionality was added over ten years ago, so I’m not hopeful that anyone knows all the details of its addition, but the issue is that if you press escape to cancel the fill, and don’t release the key before the fill cancelling is done, the subsequent release triggers the emergency exit, which from the users perspective would just be a switch to regular brush mode they did not ask for.
Moving it to the press callback would avoid the issue. I can see why it was written into release (for convenience), but no reason it cannot be moved to press with some adjustments.