From 17cb9b926ed374f67f67ef70e16bfe0aea7754d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Wed, 17 Jun 2020 15:58:01 +0200 Subject: [PATCH] Allows show selected element if a variation selector is present --- addon/globalPlugins/brailleExtender/patches.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addon/globalPlugins/brailleExtender/patches.py b/addon/globalPlugins/brailleExtender/patches.py index 64df7386..188c9cef 100644 --- a/addon/globalPlugins/brailleExtender/patches.py +++ b/addon/globalPlugins/brailleExtender/patches.py @@ -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. @@ -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: @@ -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