[orca] Ensure the end object is included in the selection subtree



commit feb44b4b7358a660a248e263d9d34944d9e2fafa
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Oct 4 14:20:06 2019 -0400

    Ensure the end object is included in the selection subtree

 src/orca/script_utilities.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 16351c8fb..ac9b085fb 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -5302,13 +5302,23 @@ class Utilities:
         if endObj == startObj:
             return subtree
 
+        if endObj not in subtree:
+            subtree.append(endObj)
+            subtree.extend(self.findAllDescendants(endObj, lambda x: x))
+
+        try:
+            lastObj = endObj.parent[endObj.getIndexInParent() + 1]
+        except:
+            lastObj = endObj
+
         try:
-            endIndex = subtree.index(endObj)
+            endIndex = subtree.index(lastObj)
         except ValueError:
-            msg = "ERROR: %s not in subtree" % endObj
-            debug.println(debug.LEVEL_INFO, msg, True)
+            pass
         else:
-            subtree = subtree[:endIndex+1]
+            if lastObj == endObj:
+                endIndex += 1
+            subtree = subtree[:endIndex]
 
         return subtree
 


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