[orca] Collapse substrings with same language but different attributes
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Collapse substrings with same language but different attributes
- Date: Fri, 7 Jan 2022 10:32:02 +0000 (UTC)
commit e298845b7bea965584dc0a559ef42a4f12e6080e
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Jan 7 11:31:18 2022 +0100
Collapse substrings with same language but different attributes
src/orca/scripts/web/script_utilities.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 79083b9d9..c3f0116b9 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -984,12 +984,17 @@ class Utilities(script_utilities.Utilities):
rv = []
attributeSet = self.getAllTextAttributesForObject(obj)
+ lastLanguage = lastDialect = ""
for (start, end, attrs) in attributeSet:
language = attrs.get("language", "")
dialect = ""
if "-" in language:
language, dialect = language.split("-")
- rv.append((start, end, language, dialect))
+ if rv and lastLanguage == language and lastDialect == dialect:
+ rv[-1] = rv[-1][0], end, language, dialect
+ else:
+ rv.append((start, end, language, dialect))
+ lastLanguage, lastDialect = language, dialect
# Embedded objects such as images and certain widgets won't implement the text interface
# and thus won't expose text attributes. Therefore try to get the info from the parent.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]