[orca/gnome-3-34] Simplify expandEOCs
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-34] Simplify expandEOCs
- Date: Thu, 26 Sep 2019 12:38:24 +0000 (UTC)
commit 4841651ad9e187b4507fb8ffc6b5490437d09469
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Sep 26 14:38:32 2019 +0200
Simplify expandEOCs
src/orca/script_utilities.py | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 50161b907..9eaa0031c 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2724,30 +2724,16 @@ class Utilities:
except:
return ""
- if self.EMBEDDED_OBJECT_CHARACTER in string:
- # If we're not getting the full text of this object, but
- # rather a substring, we need to figure out the offset of
- # the first child within this substring.
- #
- childOffset = 0
- for child in obj:
- if self.characterOffsetInParent(child) >= startOffset:
- break
- childOffset += 1
+ if not self.EMBEDDED_OBJECT_CHARACTER in string:
+ return string
- toBuild = list(string)
- count = toBuild.count(self.EMBEDDED_OBJECT_CHARACTER)
- for i in range(count):
- index = toBuild.index(self.EMBEDDED_OBJECT_CHARACTER)
- child = obj[i + childOffset]
- childText = self.expandEOCs(child)
- if not childText:
- childText = ""
- toBuild[index] = childText
+ toBuild = list(string)
+ for i, char in enumerate(toBuild):
+ if char == self.EMBEDDED_OBJECT_CHARACTER:
+ child = self.getChildAtOffset(obj, i + startOffset)
+ toBuild[i] = self.expandEOCs(child)
- string = "".join(toBuild)
-
- return string
+ return "".join(toBuild)
def isWordMisspelled(self, obj, offset):
"""Identifies if the current word is flagged as misspelled by the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]