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
Never update the local text while the user is typing #183
Comments
I can confirm. This is an excerpt from my plugin's log -
We can see that there is only one entry of |
Thank you! As a solution for this issue, I think an easy fix would be to ignore events received within the next 500ms of a native input (which the browser extension already detects and handles correctly) Could be as easy as: // on verified input
clearTimeout(localEditTimer)
localEditTimer = setTimeout(() ={localEditTimer = false}, 500)
// on received input
if (localEditTimer) return The alternative would be to constantly keep track of the browser’s focus state in the background page so that it’s available synchronously when GT received a server event. |
I am a total noob in JS, so as far as I understood, it implements a timeout, and rejects everything it receives till the timeout expires. But, overall, I still think that this is not a valid issue. The extension does what it is meant to do according to the protocol. Receive the WS message and change the text field accordingly. I personally think the issue of not echoing the sent text is the responsibility of the editor plugin. But I can't speak for other plugin's authors. |
I mean, you’re not wrong. Maybe the extension should highlight this editor mistake on the testing page. If it receives a message identical to the one just sent, show a notification. This way it would be easier for editor plugin authors to find and solve their issues, or simply include a protocol tester that does so automatically in the options page. |
There should be some logging in the background page, but I don’t remember exactly if it makes this visible. This usually isn’t a problem with short text because it’s quick enough that the content still matches, but if you use longer content and type fast in the browser you’ll see that some keypresses will be lost/overridden. |
Ah, right! 🤦 Could you grant me push access to the sublime extension repo? I will start a new branch and see what I can do. |
This is a mistake. If you're typing somewhere, that's the only version that matters. External messages should be ignored. I attempted to fix this with faa5a8d but it caused #181.
This applies to both parts (browser or editor) but it's probably easier to avoid both issues in the browser:
The text was updated successfully, but these errors were encountered: