-
-
Save evanemolo/3966741 to your computer and use it in GitHub Desktop.
Sublime Text 2 Block Cursor - outside of Vintage Mode
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
# Add this file to a directory called SublimeBlockCursor in the Packages directory. | |
import sublime | |
import sublime_plugin | |
class SublimeBlockCursor(sublime_plugin.EventListener): | |
def view_is_widget(view): | |
settings = view.settings() | |
return bool(settings.get('is_widget')) | |
def show_block_cursor(self, view): | |
validRegions = [] | |
for s in view.sel(): | |
if s.a != s.b: | |
continue | |
validRegions.append(sublime.Region(s.a, s.a + 1)) | |
if validRegions.__len__: | |
view.add_regions('SublimeBlockCursorListener', validRegions, 'block_cursor') | |
else: | |
view.erase_regions('SublimeBlockCursorListener') | |
def on_selection_modified(self, view): | |
if view.settings().get('is_widget'): | |
view.erase_regions('SublimeBlockCursorListener') | |
return | |
self.show_block_cursor(view) | |
def on_deactivated(self, view): | |
view.erase_regions('SublimeBlockCursorListener') | |
def on_activated(self, view): | |
self.show_block_cursor(view) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment