[orca] Use a different hack in the Gecko script so we can remove a call to getTextAfterOffset()



commit 2434280a3720aee991eff4981bb238741d446ca6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Apr 13 16:48:54 2013 -0400

    Use a different hack in the Gecko script so we can remove a call to getTextAfterOffset()

 src/orca/scripts/toolkits/Gecko/script.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 16760c4..5ced608 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -3805,20 +3805,16 @@ class Script(default.Script):
         if not text:
             offset = 0
         else:            
-            [line, start, end] = text.getTextAtOffset(offset, boundary)
+            if offset == -1:
+                offset = 0
 
-            # Unfortunately, we sometimes get bogus results from Gecko when
-            # we ask for this line. If the offset is not within the range of
-            # characters on this line, try the character reported as the end.
-            #
-            if not (start <= offset < end):
-                [line, start, end] = text.getTextAfterOffset(end, boundary)
+            [line, start, end] = text.getTextAtOffset(offset, boundary)
 
             # If we're still seeing bogusity, which we only seem to see when
             # moving up, locate the previous character and use it instead.
             #
             if not (start <= offset < end):
-                pObj, pOffset = self.findPreviousCaretInOrder(obj, offset)
+                pObj, pOffset = self.findPreviousCaretInOrder(obj, end)
                 if pObj:
                     obj, offset = pObj, pOffset
                     text = self.utilities.queryNonEmptyText(obj)


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