Skip to content

Commit

Permalink
Allows show selected element if a variation selector is present
Browse files Browse the repository at this point in the history
  • Loading branch information
AAClause committed Oct 25, 2020
1 parent 32cae3b commit 17cb9b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addon/globalPlugins/brailleExtender/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def script_braille_routeTo(self, gesture):
except IndexError: pass

# braille.Region.update()
variationSelectorsPattern = lambda: r"([^\ufe00-\ufe0f])[\ufe00-\ufe0f]\u20E3?"
def update(self):
"""Update this region.
Subclasses should extend this to update L{rawText}, L{cursorPos}, L{selectionStart} and L{selectionEnd} if necessary.
Expand All @@ -115,7 +116,7 @@ def update(self):
@postcondition: L{brailleCells}, L{brailleCursorPos}, L{brailleSelectionStart} and L{brailleSelectionEnd} are updated and ready for rendering.
"""
if config.conf["brailleExtender"]["advanced"]["fixCursorPositions"]:
pattern = r"([^\ufe00-\ufe0f])[\ufe00-\ufe0f]\u20E3?"
pattern = variationSelectorsPattern()
matches = re.finditer(pattern, self.rawText)
posToRemove = []
for match in matches:
Expand Down Expand Up @@ -151,6 +152,8 @@ def update(self):
addDots = d[config.conf["brailleExtender"]["attributes"]["selectedElement"]]
if hasattr(self, "obj") and self.obj and hasattr(self.obj, "states") and self.obj.states and self.obj.name and controlTypes.STATE_SELECTED in self.obj.states:
name = self.obj.name
if config.conf["brailleExtender"]["advanced"]["fixCursorPositions"]:
name = re.sub(variationSelectorsPattern(), r"\1", name)
if name in self.rawText:
start = self.rawText.index(name)
end = start + len(name)-1
Expand Down

0 comments on commit 17cb9b9

Please sign in to comment.