Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Undoing during freehand line results in editing previous undo state

Open nyanpasu64 opened this issue 3 years ago • 4 comments

  • Visit https://editor.graphite.rs/.
  • Click "Freehand Tool".
  • Draw a line on the canvas. (If you skip this, you edit the initial state of the document, and can't undo your subsequent line.)
  • Draw a line, and while the mouse is held, press Ctrl+Z.

The second line vanishes.

  • Move the mouse again.

The second line reappears. In F12, I get: error DocumentError: LayerNotFound([8883258809406379036]). Releasing the mouse and pressing Ctrl+Z undoes both lines at once.

If you draw multiple lines upfront, you can press Ctrl+Z multiple times and edit multiple undo steps.

Possibly related to #558.

Browser: Firefox 97.0 (64-bit)

nyanpasu64 avatar Feb 16 '22 12:02 nyanpasu64

OK, every tool has its own misbehavior if you undo during a draw operation. The Line/Rectangle/Ellipse/Shape tools spam DocumentError: LayerNotFound([]). The spline tool acts like freehand.

nyanpasu64 avatar Feb 16 '22 12:02 nyanpasu64

Closed by #560

Keavon avatar Feb 16 '22 16:02 Keavon

Apparently this got reopened and closed a second time. Was that intentional?

Testing at https://editor.graphite.rs/, undoing during a freehand stroke moves back by 1 undo step, but fails to remove the object being created, and prints error DocumentError: LayerNotFound([15614631032649384611]) as well. Continuing to drag the mouse no longer has an effect (unlike before). Now when you undo a second time, you revert two lines at once. If you redo instead of undoing, you redo a no-op edit.

nyanpasu64 avatar Feb 16 '22 18:02 nyanpasu64

Yes, that is true my main priority was to keep the editor from crashing the error is basically an indicator that the tool assumes there to be a layer that no longer exists. The inconsistent behaviour has to be dealt with as well, might have closed the wrong issue then, sorry about that

TrueDoctor avatar Feb 16 '22 19:02 TrueDoctor