[orca] More work on bgo#592634 - The Gecko script's handling of caret navigation interferes when navigating



commit 048a23bc2744ba873d16e216a3959344ec2444a9
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Aug 30 23:24:36 2009 -0400

    More work on bgo#592634 - The Gecko script's handling of caret navigation interferes when navigating editable messages in Thunderbird

 src/orca/scripts/apps/Thunderbird/script.py |   28 ++++++++++++--------------
 src/orca/scripts/toolkits/Gecko/script.py   |   11 ++++++++++
 2 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index db04247..551d39a 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -589,21 +589,19 @@ class Script(Gecko.Script):
 
     def getBottomOfFile(self):
         """Returns the object and last caret offset at the bottom of the
-         document frame. Overridden here because really long text messages
-         with no links near the bottom are not handled efficiently by the
-         Gecko script's method."""
-
-        obj = self.getDocumentFrame()
-        text = self.queryNonEmptyText(obj)
-        if text:
-            lastOffset = text.characterCount - 1
-            lastChar = text.getText(lastOffset - 1, lastOffset)
-            if lastChar != self.EMBEDDED_OBJECT_CHARACTER:
-                obj, lastOffset = \
-                    self.findPreviousCaretInOrder(obj, lastOffset - 1)
-                return obj, lastOffset
-
-        return Gecko.Script.getBottomOfFile(self)
+        document frame. Overridden here to handle editable messages.
+        """
+
+        # Pylint thinks that obj is an instance of a list. It most
+        # certainly is not. Silly pylint.
+        #
+        # pylint: disable-msg=E1103
+        #
+        [obj, offset] = Gecko.Script.getBottomOfFile(self)
+        if obj and obj.getState().contains(pyatspi.STATE_EDITABLE):
+            offset += 1
+
+        return [obj, offset]
 
     def getDocumentFrame(self):
         """Returns the document frame that holds the content being shown.
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 1d890da..4bb4799 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -3847,6 +3847,17 @@ class Script(default.Script):
         obj = self.getLastObject(documentFrame)
         offset = 0
 
+        # If the last object is a link, it may be more efficient to check
+        # for text that follows.
+        #
+        if obj.getRole() == pyatspi.ROLE_LINK:
+            text = self.queryNonEmptyText(obj.parent)
+            if text:
+                char = text.getText(text.characterCount - 1,
+                                    text.characterCount)
+                if char != self.EMBEDDED_OBJECT_CHARACTER:
+                    return [obj.parent, text.characterCount - 1]
+
         # obj should now be the very last item in the entire document frame
         # and not have children of its own.  Therefore, it should have text.
         # If it doesn't, we don't want to be here.



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