gh-158563: Fix various bugs in turtle's undo handling - #158564
StanFromIreland wants to merge 2 commits into
Conversation
| if was_filling and not fill_gap: | ||
| self.end_fill() |
There was a problem hiding this comment.
When teleport() runs during an active fill with the default fill_gap=False, its new undo sequence ends the original fill and starts another, but does not preserve the original fill state. Undoing the sequence clears the new fill through the beginfill handler without restoring the old _fillitem or _fillpath. For example, begin_fill(); forward(10); teleport(100, 100); undo() restores the position but leaves filling() false, so subsequent drawing cannot complete the original polygon.
There was a problem hiding this comment.
This is an existing bug, and it's not just for teleport. A proper fix could be for begin_fill() and end_fill() to record the fill item and path they replace in their undo entries, and undo() would restore them, so undoing either call (or a teleport() during a fill) resumes the original fill. However this would alter the number of entries in the undo buffer, so this needs to be a 3.16-only change to not break scripts that may be relying on the current number.
We can do this in a follow up to ease backporting.
turtle's undo handling to fix various issues #158563