From 51fcca029ddcbe09316bbb9b5eebe07b163e0d59 Mon Sep 17 00:00:00 2001 From: "@damnwidget" Date: Sat, 31 Aug 2013 23:31:33 +0100 Subject: [PATCH] added blink indicator to GoTo and FindUsages commands --- .gitignore | 1 + anaconda.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.gitignore b/.gitignore index 6668878c..5f0ddd12 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ nosetests.xml # Don't track Main.sublime-menu anymore Main.sublime-menu +*.pickle diff --git a/anaconda.py b/anaconda.py index ca43f52e..b0cd06b7 100644 --- a/anaconda.py +++ b/anaconda.py @@ -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 """ @@ -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