Skip to content

Commit bcb414f

Browse files
authored
Merge pull request #51 from ice9js/fix/overlapping-commands
Ensure AceJump commands can only be activated one at a time
2 parents e79d42f + 244679d commit bcb414f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ace_jump.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
mode = 0
1111

12+
ace_jump_active = False
13+
1214
def get_active_views(window, current_buffer_only):
1315
"""Returns all currently visible views"""
1416

@@ -73,6 +75,9 @@ class AceJumpCommand(sublime_plugin.WindowCommand):
7375
"""Base command class for AceJump plugin"""
7476

7577
def run(self, current_buffer_only = False):
78+
global ace_jump_active
79+
ace_jump_active = True
80+
7681
self.char = ""
7782
self.target = ""
7883
self.views = []
@@ -99,6 +104,10 @@ def run(self, current_buffer_only = False):
99104

100105
self.show_prompt(self.prompt(), self.init_value())
101106

107+
def is_enabled(self):
108+
global ace_jump_active
109+
return not ace_jump_active
110+
102111
def show_prompt(self, title, value):
103112
"""Shows a prompt with the given title and value in the window"""
104113

@@ -128,8 +137,7 @@ def on_input(self, command):
128137

129138
def submit(self):
130139
"""Handles the behavior after closing the prompt"""
131-
132-
global next_search, mode
140+
global next_search, mode, ace_jump_active
133141
next_search = False
134142

135143
self.remove_labels()
@@ -138,6 +146,7 @@ def submit(self):
138146
self.jump(self.labels.find(self.target))
139147

140148
mode = 0
149+
ace_jump_active = False
141150

142151
def add_labels(self, regex):
143152
"""Adds labels to characters matching the regex"""

0 commit comments

Comments
 (0)