Index: orca/ChangeLog
===================================================================
RCS file: /cvs/gnome/orca/ChangeLog,v
retrieving revision 1.544
diff -p -u -r1.544 ChangeLog
--- orca/ChangeLog	27 Jun 2006 08:58:17 -0000	1.544
+++ orca/ChangeLog	27 Jun 2006 13:58:47 -0000
@@ -1,4 +1,14 @@
+2006-06-27  Willie Walker <william.walker@sun.com>
+
+	* src/orca/braille.py, src/orca/flat_review.py: more fixing for
+	bug 343133 where Orca would hang when going into flat review of a
+	man page in gnome-terminal.  The problem is that the AT-SPI
+	implementation of text in gnome-terminal appears to produce
+	inaccurate and wild results.  We need to handle this defensively.
+	
+
 2006-06-27  Runa Bhattacharjee <runa@bengalinux.org>
+
 	* configure.in: Added Bengali (bn) to ALL_LINGUAS.
 
 2006-06-26  Rich Burridge <rich.burridge@sun.com>
Index: orca/src/orca/braille.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/braille.py,v
retrieving revision 1.55
diff -p -u -r1.55 braille.py
--- orca/src/orca/braille.py	10 Jun 2006 00:54:47 -0000	1.55
+++ orca/src/orca/braille.py	27 Jun 2006 13:58:48 -0000
@@ -279,17 +279,29 @@ class Text(Region):
         """
 
         self.accessible = accessible
-        result = util.getTextLineAtCaret(self.accessible)
-        self.caretOffset = result[1]
-        self.lineOffset = result[2]
+        [string, self.caretOffset, self.lineOffset] = \
+                 util.getTextLineAtCaret(self.accessible)
+
+        # Sometimes, gnome-terminal will give us very odd values when
+        # the user is editing using 'vi' and has positioned the caret
+        # at the first character of the first line.  In this case, we
+        # end up getting a very large negative number for the line offset.
+        # So, we just assume the user is at the first character.
+        #
+        if self.lineOffset < 0:
+            self.caretOffset = 0
+            self.lineOffset = 0
+            [string, startOffset, endOffset] = \
+                self.accessible.text.getTextAtOffset(
+                    0,
+                    atspi.Accessibility.TEXT_BOUNDARY_LINE_START)
+
         cursorOffset = self.caretOffset - self.lineOffset
 
         self.label = label
         if self.label:
-            string = self.label + " " + result[0]
+            string = self.label + " " + string
             cursorOffset += len(self.label) + 1
-        else:
-            string = result[0]
 
         Region.__init__(self, string, cursorOffset)
 
Index: orca/src/orca/flat_review.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/flat_review.py,v
retrieving revision 1.38
diff -p -u -r1.38 flat_review.py
--- orca/src/orca/flat_review.py	10 Jun 2006 00:54:47 -0000	1.38
+++ orca/src/orca/flat_review.py	27 Jun 2006 13:58:48 -0000
@@ -1102,6 +1102,8 @@ def getZonesFromAccessible(accessible, c
             #
             if startOffset < 0:
                 break
+            if endOffset < offset:
+                break
 
             # [[[WDW - HACK: this is here because getTextAtOffset
             # tends not to be implemented consistently across toolkits.
