Advertisement
FichteFoll

SublimeText ShowZeroWidthSpace

Apr 3rd, 2013
3,993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. # http://sublimetext.userecho.com/topic/104394-is-it-possible-to-show-all-characters-spaces-tabs-cr-lf-etc/#comment_180170
  2. import sublime_plugin
  3.  
  4.  
  5. class ShowZeroWidthSpace(sublime_plugin.EventListener):
  6.     def on_modified(self, view):
  7.         spaces = []
  8.         p = 0
  9.         while 1:
  10.             s = view.find(u'\u200b', p + 1)
  11.             if not s:
  12.                 break
  13.             spaces.append(s)
  14.             p = s.a
  15.  
  16.         if spaces:
  17.             view.add_regions("zero-width", spaces, "string")
  18.         else:
  19.             view.erase_regions("zero-width")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement