-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Remove a cursor with an invalid index in _updateCursor() #412
Conversation
Deltas have a method for transforming a cursor position so whatever is currently being used to resolve text conflicts should also be able to resolve cursor positions. |
I am aware of Imagine an OT system with two clients A and B, and a server S. In this system, as A makes changes, I keep track of the pending diff ( However, there is a brief window of time after S has replied "OK Saved" to A, but before B is notified of the change. If B moves her cursor during this time, A will receive B's cursor-change broadcast, but have no I tried surrounding my call to Therefore, I think it is important for |
I'm not understanding how text transformation could work but cursor transformation contains a window that doesn't work 10% of the time. The cursor information could be represented as a text insertion of a unique character so it's really just a special case of text transformation. Issues do arise if cursor updates are sent/received on different a different channel than text. Regardless, multi-cursor's updateCursor call is very brittle and should be improved. I'm not sure why getBounds throws an error (as that's not idiomatic in Quill's codebase) but it should probably return null instead and updateCursor on a null/invalid boundary could remove the cursor. Would you be amenable to these changes instead? |
I can change |
I meant why I coded |
Updated to have |
Great thanks! |
Remove a cursor with an invalid index in _updateCursor()
An example scenario:
The right thing to do in this scenario would be to transform Client A's cursor against the 20 character deletion. However, the amount of bookkeeping necessary to compute this diff is not trivial, and so for this edge case I prefer to just remove the offending cursor.