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

Already on GitHub? Sign in to your account

Exception when trying to compose lastOperation. #19

Closed
mikelehen opened this Issue Mar 17, 2013 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

mikelehen commented Mar 17, 2013

Repro:

  1. Add a character ('X') in first editor.
  2. In a second editor, add a character some place after the 'X'.
  3. Add a character 'Y' directly after 'X' in the first editor.

Result:
Uncaught Error: The base length of the second operation has to be the target length of the first operation
from "this.lastOperation = this.lastOperation.compose(textOperation);" in editor-client.js

I believe the problem is lastOperation isn't being transformed when we get new remote operations.

@timjb timjb closed this in 9f164f1 Mar 18, 2013

Owner

timjb commented Mar 18, 2013

You're correct. However, transforming lastOperation is non-trivial, as it would require a different kind of transform that exchanges operations that happened after each other. I ended up writing a method that decides whether two already inverted operations should be composed in the undo stack, therefore eliminating the need for lastOperation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment