Skip to content

Commit

Permalink
added blink indicator to GoTo and FindUsages commands
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed Aug 31, 2013
1 parent fdb1c05 commit 51fcca0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ nosetests.xml

# Don't track Main.sublime-menu anymore
Main.sublime-menu
*.pickle
24 changes: 24 additions & 0 deletions anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ def _jump(self, filename, lineno=None, columno=None):
sublime.ENCODED_POSITION
)

self._toggle_indicator(lineno, columno)

def _show_options(self, defs, usages):
"""Show a dropdown quickpanel with options to jump
"""
Expand All @@ -426,6 +428,28 @@ def _show_options(self, defs, usages):
self.options = defs
self.text.view.window().show_quick_panel(options, self._jump)

def _toggle_indicator(self, lineno=0, columno=0):
"""Toggle mark indicator for focus the cursor
"""

pt = self.text.view.text_point(lineno - 1, columno)
region_name = 'anaconda.indicator.{}.{}'.format(
self.text.view.id(), lineno
)
show = lambda: self.text.view.add_regions(
region_name,
[sublime.Region(pt, pt)],
'comment',
'bookmark',
sublime.DRAW_EMPTY_AS_OVERWRITE
)
hide = lambda: self.text.view.erase_regions(region_name)

for i in range(3):
delta = 300 * i * 2
sublime.set_timeout(show, delta)
sublime.set_timeout(hide, delta + 300)


def plugin_loaded():
"""Called directly from sublime on plugin load
Expand Down

0 comments on commit 51fcca0

Please sign in to comment.