Skip to content

Instantly share code, notes, and snippets.

@evenicoulddoit
Created July 21, 2016 09:36
Show Gist options
  • Save evenicoulddoit/4b2158edc4fce23276a53ece31ee679e to your computer and use it in GitHub Desktop.
Save evenicoulddoit/4b2158edc4fce23276a53ece31ee679e to your computer and use it in GitHub Desktop.
import sublime_plugin
class ShowZeroWidthSpace(sublime_plugin.EventListener):
def on_modified_async(self, view):
spaces = []
p = 0
while True:
s = view.find('\u200b', p + 1)
if not s:
break
spaces.append(s)
p = s.a
if spaces:
view.add_regions("zero-width", spaces, "invalid")
else:
view.erase_regions("zero-width")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment