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
23 changes: 12 additions & 11 deletions select_quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ def getStringRegion(self, region, around=False):
if self.view.score_selector(pos, "string.quoted") <= 0:
return None

# Turn on 'round' implicitly if...
# The start of the selection is a quote
if self.view.score_selector(region.a, "punctuation.definition.string") > 0:
around = True
# The end of the selection is a quote
if self.view.score_selector(region.b, "punctuation.definition.string") > 0:
around = False
# The selected region is abutted by quotes on either side
if (self.view.score_selector(region.a - 1, "punctuation.definition.string") > 0 and
self.view.score_selector(region.b + 1, "punctuation.definition.string") > 0):
around = True
if region.a != region.b:
# Turn on 'round' implicitly if...
# The start of the selection is a quote
if self.view.score_selector(region.a, "punctuation.definition.string") > 0:
around = True
# The end of the selection is a quote
if self.view.score_selector(region.b, "punctuation.definition.string") > 0:
around = True
# The selected region is abutted by quotes on either side
if (self.view.score_selector(region.a - 1, "punctuation.definition.string") > 0 and
self.view.score_selector(region.b + 1, "punctuation.definition.string") > 0):
around = True

# Predicates for if we should continue expanding the selection foreward/back
if around:
Expand Down