Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions thesaurus.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def processWord(self, word):
sublime.active_window().show_quick_panel(self.alternatives, self.alternativeIsSelected)

def alternativeIsSelected(self, value):
if value > 1:
if value >= 1:
self.processWord(self.alternatives[value])
else:
self.view.erase_status("Thesaurus")
Expand All @@ -78,7 +78,7 @@ def replace(self, value):

value = re.subn(r'\(.*?\)$', "", value)[0]
if value is not None:
self.view.replace(self.edit, self.region, value.strip().lower())
self.view.run_command("insert", {"characters": value.strip().lower()})

def synonyms(self):
result = []
Expand Down Expand Up @@ -129,7 +129,9 @@ def get_alternative_words(self):
p.stdout.close()
alternatives = []
# this will replace the alternatives var
exec(alternativesString)
ldict = {}
exec(alternativesString, globals(), ldict)
alternatives = ldict['alternatives']
except Exception as err:
alternatives = ['error', str(err)]
if alternatives[0] == "error":
Expand Down