Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Just a quick fix, cool plugin btw #1

Closed
wants to merge 1 commit into from

2 participants

@alexrussell

Fixed the error message always displaying even when it finds a match, also made comments a little clearer. My Python's not too great so sorry if I've gone about this in a long-winded way.

@alexrussell alexrussell Fixed the error message always displaying even when it finds a match,…
… also made comments a little clearer. My Python's not too great so sorry if I've gone about this in a long-winded way.
c3b5244
@gordio
Owner

Thank!

@gordio gordio closed this
@alexrussell

Good idea on return rather than the flag - I knew there was a better way but my brain wasn't working yet! Thanks for implementing though!

@gordio
Owner

Thanks you, that inform me. (sorry bad English ;))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 2, 2011
  1. @alexrussell

    Fixed the error message always displaying even when it finds a match,…

    alexrussell authored
    … also made comments a little clearer. My Python's not too great so sorry if I've gone about this in a long-winded way.
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 4 deletions.
  1. +14 −4 ToggleBool.py
View
18 ToggleBool.py
@@ -10,32 +10,42 @@
class ToggleBoolCommand(sublime_plugin.TextCommand):
def toggle_bool(self, view, region):
word = self.view.substr(region)
+ found = False
for bool_word in bool_dict:
if word == bool_word[0]:
+ found = True
self.view.replace(view, region, bool_word[1])
continue
if word == bool_word[1]:
+ found = True
self.view.replace(view, region, bool_word[0])
continue
- # For first letter apper
+ # For case when first letter is uppercase
if word == bool_word[0].capitalize():
+ found = True
self.view.replace(view, region, bool_word[1].capitalize())
continue
if word == bool_word[1].capitalize():
+ found = True
self.view.replace(view, region, bool_word[0].capitalize())
continue
- # For all letter's apper
+ # For case when all letters are uppercase
if word == bool_word[0].upper():
+ found = True
self.view.replace(view, region, bool_word[1].upper())
continue
if word == bool_word[1].upper():
+ found = True
self.view.replace(view, region, bool_word[0].upper())
continue
- sublime.status_message("ToggleBool: Can't find toggles for '%s'" % word)
-
+
+ # Word not found?
+ if found == False:
+ sublime.status_message("ToggleBool: Can't find toggles for '%s'" % word)
+
def run(self, view):
for region in self.view.sel():
word_region = self.view.word(region)
Something went wrong with that request. Please try again.