Hopefully fixing the rest of our undo issues #2559
Merged
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.
As has been noted previously, I think the issue behind this second "undo" problem is because we separate EditorIdentity not only by
fileName
, but also byviewColumn
. This is problematic for several reasons.viewColumn
isn't how we think about what our current editor is. For example, if one drags a file from column 1 to column 2, one'd expect that to be the same editor.Looking at these 2 problems, we arrive at what is the fundamental problem: There can be multiple
undoStates
for the same file, indexed byviewColumn
. Here are a couple of cases where this is a problem.Case 1:
The repro @johnfn reported: #928 (comment)
I'll write it out here for clarity. For the sake of succinctness, I'll assume there's only one file in each column so "making a few changes in column 1" has the same meaning as "making a few changes in column 1's version of the file".
Case 2:
Case 3:
I suspect that most of the bugs people have seen are variations of one of these.
Luckily, there's a simple fix: Don't separate
ModeHandler
byviewColumn
. I'm not sure what that breaks. You can still have different positions in different columns at the same time just fine; we use VSCode's concept of "saved position" for that. I think somebody mentioned that it lets us have different modes in different files (so insert mode in Column 1, normal mode in Column 2). If that's the only issue, I strongly believe that we should break that for now, and add it in later (perhaps with a separate structure frommodeHandler
).cc @jpoon @xconverge @rebornix @johnfn