GhostText
GhostText copied to clipboard
Sublime Text echoes the same received text
This happens in any field in any browser. ST responds with the same data as soon as you type something in the browser
https://ghosttext.github.io/GhostText/demo/
This issue is currently avoided by ignoring any updates from the editor when the browser is focused, but it should still be fixed in Sublime Text.
GhostText.py
+do_not_respond = False
...
def on_message(self, text):
+ global do_not_respond
+ do_not_respond = True
try:
request = json.loads(text)
self._current_view.run_command('replace_content', request)
self._current_view.window().focus_view(self._current_view)
except ValueError as e:
Utils.show_error(e, 'Invalid JSON')
+ finally:
+ do_not_respond = False
....
GhostTextTools/OnSelectionModifiedListener.py
...
def on_selection_modified(self, view):
if view.id() not in OnSelectionModifiedListener._bind_views:
return
+ global do_not_respond
+ if do_not_respond:
+ return
...
It should™ solve the issue
I will™ try it once the stores accept the latest version
Can you open a PR on https://github.com/GhostText/GhostText-for-SublimeText?
I tried it, it doesn't work :disappointed:
Can you please grant me push access to that repo? I will do my changes in a new branch. If the code seems OK, and I am able to understand how sublime plugins work, I will take up the responsibility of maintaining that plugin.
You can submit a regular PR and merge it once it works
I made a PR ☝️ https://github.com/GhostText/GhostText-for-SublimeText/pull/2 👈
Confirmed to be fixed in v1.0.15
Thanks @kaste!