Closed
Conversation
added 2 commits
January 23, 2022 14:38
Added diff-to-full undo state conversion on real-time ticks. (Real-time ticks do not generate new undo states. This means that undoing a 'diff'-ed state could produce incorrect results if real-time ticks had happened in the intervening interval. Specifically, diffs are applied to the current state. In the case that the state had changed due to real-time ticks, the current state would not be the same as the state with respect to which the diff was created. Applying the diff in such a case could produce an incorrect result. This commit fixes the issue by converting a diff-type undo on the top of the undo stack to a full undo (using the correct reference state) when handling a real-time tick.)
Owner
|
aha, great catch :) I'll review it asap Thanks! |
Owner
|
I accepted this by manually pasting the code and doing some minor code-rearranging. I had completely forgotten that the undo-buffer does all its diffing backwards and was briefly highly confused trying to read the code 🙃 Because of how I did it your change isn't nicely represented as a merge in the diff graph between repos, but I figure it's more important to get the fix in than to figure out how the best flow for github (even if that acknowledges your contribution more actively/neatly). Thank you for the fix! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 'diff' undo mechanism breaks down when real-time ticks are used, since they change level state without generating any undo data for those changes; thus, the diffs get applied to the wrong state. (Diffs are applied to the current state. In the case that the state had changed due to real-time ticks, the current state would not be the same as the state with respect to which the diff was created.)
This corrects that issue by restoring diff-type undos to full undos as needed to prevent such inconsistencies, and adds a test for such issues.
An example where the issue occurs: