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 misplacement on concurrent editing with 'Enter'/new lines #2

Open
pedrosanta opened this issue May 25, 2017 · 4 comments
Open
Labels

Comments

@pedrosanta
Copy link
Owner

Sometimes, when two or more users are typing and adding new lines/pressing Enter key, it can lead to cursor misplacement/shift off by one, two, etc, positions.

You can replicate this by having two people on this example, one writing forward without entering new lines, and another writing and adding a few new lines. This doesn't occur on the first new line attempts, but after a solid half-dozen or more new lines/enter keypresses by the second person.

Also needs more testing/debugging.

@pedrosanta pedrosanta added the bug label May 25, 2017
@pedrosanta
Copy link
Owner Author

pedrosanta commented May 26, 2017

Just added something that can alleviate this issue, added a mechanism that forces a cursor update some time after the user stops typing (and it's debounced): af81b13

It's not ideal, and it's a fix, but it helps the cursor position to heal/re-sync when its position becomes 'dirty'.

It improves #1 too.

@sferoze
Copy link

sferoze commented Jul 1, 2017

@pedrosanta I've noticed the debounce timeout is 1500, but it updates much quicker and works better with lower debounce time, like 100ms. Why did you choose 1500 as the debounce timeout?

@sferoze
Copy link

sferoze commented Jul 1, 2017

@pedrosanta I have also noticed in my console that I get the console.log('Troubles!', cursor) statement reached quite often. But it still appears that the cursor works just fine... Why is this?

@pedrosanta
Copy link
Owner Author

@pedrosanta I have also noticed in my console that I get the console.log('Troubles!', cursor) statement reached quite often. But it still appears that the cursor works just fine... Why is this?

That's something I'm still checking out. I have since improved that overly generic logging to a more sensible console.warn. But, I've managed to catch a case or two when that happens – check reedsy/quill-cursors#8.

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

No branches or pull requests

2 participants