Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor states are not correctly restored after clearing undo stack (doesn't affect wodo) #903

Open
peitschie opened this issue Jun 7, 2015 · 4 comments

Comments

@peitschie
Copy link
Contributor

The undo stack can be cleared by calling setInitialState() on the gui.TrivialUndoManager component. However, the cursor-extraction logic incorrectly assumes that last OpMoveCursor operation is the current location of the cursor, which is not the case if text editing has occurred.

See comment and related block of code in e6cb301 and workaround code in pr #900 (saveCurrentCursorPositions).

@vandenoever
Copy link
Member

Could you write a small test case / unit test and add it to tests/gui/TrivialUndoManagerTests.js, perhaps in a new list this.brokenTests?

@peitschie
Copy link
Contributor Author

Could you write a small test case / unit test and add it to tests/gui/TrivialUndoManagerTests.js, perhaps in a new list this.brokenTests?

It's not really a high priority for me at the moment...

@vandenoever
Copy link
Member

Can you describe the issue a bit more, then I'll have a go at a unit test for the issue.

@kossebau
Copy link
Contributor

kossebau commented Jun 7, 2015

Issue as I again understand it (sleeping works wonders):
if the trivialundomanager is asked to dump its current stack of states (on a given document), it still needs to have an initial state transition after that dump which describes the current cursor positions. Because added cursors would be positioned at the beginning of the document, and the diff to the current existing state of the document can be described by adding matching cursor ops as that initial state transition.
Problem now is that the current code simply takes that last cursor move ops from the old stack to get the cursor ops for the new initial state transition. Which might not really match the current state of the document, because since that cursor move op was done, other ops might have removed/added things in front of the cursor, thus invalidating the position as used in the last cursor op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants