From 75037575c436e4dddc26c66f5edae187ea56429e Mon Sep 17 00:00:00 2001 From: "Micha J." Date: Wed, 22 May 2013 10:51:59 +0200 Subject: [PATCH] Update for Python 3 syntax Updates the file for Python 3, so it runs with Sublime Text 3. Not sure whether there is a better way than explicitly converting all_before and all_after to lists ...!? But that works. --- ExpandSelectionToQuotes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ExpandSelectionToQuotes.py b/ExpandSelectionToQuotes.py index 4d82551..bb0fac7 100644 --- a/ExpandSelectionToQuotes.py +++ b/ExpandSelectionToQuotes.py @@ -15,8 +15,8 @@ class ExpandSelectionToQuotesCommand(sublime_plugin.TextCommand): def run(self, edit): - d_quotes = map(lambda x: x.begin(), self.view.find_all('"')) - s_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("'")) for sel in self.view.sel(): def search_for_quotes(q_type, quotes): @@ -25,6 +25,9 @@ def search_for_quotes(q_type, quotes): if len(quotes) - self.view.substr(sel).count('"') >= 2: all_before = filter(lambda x: x < sel.begin(), 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_after: after = all_after[0]