[orca] Handle duplicate text events and objects



commit f7996b30ab7f72b8eabaa2a632c2471a266efa20
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Jan 16 14:29:01 2016 -0500

    Handle duplicate text events and objects

 src/orca/script_utilities.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 86736ee..dc07d91 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -3415,9 +3415,17 @@ class Utilities:
                 self._script.pointOfReference['entireDocumentSelected'] = False
                 self._script.pointOfReference['textSelections'] = {}
 
+        textSelections = self._script.pointOfReference.get('textSelections', {})
+
+        # Because some apps and toolkits create, destroy, and duplicate objects
+        # and events.
+        if hash(obj) in textSelections:
+            value = textSelections.pop(hash(obj))
+            for x in [k for k in textSelections.keys() if textSelections.get(k) == value]:
+                textSelections.pop(x)
+
         # TODO: JD - this doesn't yet handle the case of multiple non-contiguous
         # selections in a single accessible object.
-        textSelections = self._script.pointOfReference.get('textSelections', {})
         if text:
             start, end = text.getSelection(0)
             string = text.getText(start, end)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]