[orca] Be more forgiving of broken text attribute implementations



commit 623a928c75621537aec37d8301910ef05cf27b6d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jan 7 11:15:29 2022 +0100

    Be more forgiving of broken text attribute implementations

 src/orca/script_utilities.py | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c5015ec2a..42f9a1d88 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -3160,19 +3160,12 @@ class Utilities:
         offset = 0
         while offset < text.characterCount:
             attrList, start, end = text.getAttributeRun(offset)
-            if start == end:
-                msg = "INFO: start and end offsets should not be equal in attribute run"
-                debug.println(debug.LEVEL_INFO, msg, True)
-                break
-
-            if start < offset:
-                msg = "INFO: Unexpected start offset less than offset in attribute run"
-                debug.println(debug.LEVEL_INFO, msg, True)
-                break
+            msg = "INFO: Attributes at %i: %s (%i-%i)" % (offset, attrList, start, end)
+            debug.println(debug.LEVEL_INFO, msg, True)
 
             attrDict = dict([attr.split(':', 1) for attr in attrList])
-            rv.append((start, end, attrDict))
-            offset = end
+            rv.append((max(start, offset), end, attrDict))
+            offset = max(end, offset + 1)
 
         msg = "INFO: Result: %s" % rv
         debug.println(debug.LEVEL_INFO, msg, True)


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