Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with Python 3/Sublime Text 3 #6

Merged
merged 1 commit into from Jun 2, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions ExpandSelectionToQuotes.py
Expand Up @@ -15,8 +15,8 @@


class ExpandSelectionToQuotesCommand(sublime_plugin.TextCommand): class ExpandSelectionToQuotesCommand(sublime_plugin.TextCommand):
def run(self, edit): def run(self, edit):
d_quotes = map(lambda x: x.begin(), self.view.find_all('"')) [*d_quotes] = map(lambda x: x.begin(), self.view.find_all('"'))
s_quotes = map(lambda x: x.begin(), self.view.find_all("'")) [*s_quotes] = map(lambda x: x.begin(), self.view.find_all("'"))


for sel in self.view.sel(): for sel in self.view.sel():
def search_for_quotes(q_type, quotes): def search_for_quotes(q_type, quotes):
Expand All @@ -25,6 +25,9 @@ def search_for_quotes(q_type, quotes):
if len(quotes) - self.view.substr(sel).count('"') >= 2: if len(quotes) - self.view.substr(sel).count('"') >= 2:
all_before = filter(lambda x: x < sel.begin(), quotes) all_before = filter(lambda x: x < sel.begin(), quotes)
all_after = filter(lambda x: x >= sel.end(), quotes) all_after = filter(lambda x: x >= sel.end(), quotes)

all_before = list(all_before)
all_after = list(all_after)


if all_before: before = all_before[-1] if all_before: before = all_before[-1]
if all_after: after = all_after[0] if all_after: after = all_after[0]
Expand Down