Created
July 21, 2016 09:36
-
-
Save evenicoulddoit/4b2158edc4fce23276a53ece31ee679e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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