Index: src/orca/Gecko.py
===================================================================
--- src/orca/Gecko.py	(revision 2389)
+++ src/orca/Gecko.py	(working copy)
@@ -253,9 +253,7 @@
             label = parent.name
 
         textRegion = braille.Text(obj, label)
-        regions.append(textRegion)
-        eol = braille.Region(" $l")
-        regions.append(eol)
+        regions.append(textRegion, None, " $l")
         return [regions, textRegion]
 
     def _getBrailleRegionsForComboBox(self, obj):
@@ -3047,9 +3045,7 @@
                 or ((obj.role == rolenames.ROLE_DOCUMENT_FRAME) \
                     and obj.state.count(atspi.Accessibility.STATE_EDITABLE)):
                 label = self.getDisplayedLabel(obj)
-                regions = [braille.Text(obj, label)]
-                eol = braille.Region(" $l")
-                regions.append(eol)
+                regions = [braille.Text(obj, label, " $l")]
                 if isFocusedObj:
                     focusedRegion = regions[0]
             elif obj.text:
Index: src/orca/braille.py
===================================================================
--- src/orca/braille.py	(revision 2389)
+++ src/orca/braille.py	(working copy)
@@ -343,7 +343,7 @@
     [[[TODO: WDW - need to add in text selection capabilities.  Logged
     as bugzilla bug 319754.]]]"""
 
-    def __init__(self, accessible, label=None):
+    def __init__(self, accessible, label=None, eol=""):
         """Creates a new Text region.
 
         Arguments:
@@ -372,6 +372,10 @@
 
         cursorOffset = self.caretOffset - self.lineOffset
 
+        self._maxCaretOffset = self.lineOffset + len(string.decode("UTF-8"))
+
+        string = string + eol
+
         self.label = label
         if self.label:
             string = self.label + " " + string
@@ -412,7 +416,7 @@
             if offset < 0:
                 return
 
-        newCaretOffset = self.lineOffset + offset
+        newCaretOffset = min(self.lineOffset + offset, self._maxCaretOffset)
         self.accessible.text.setCaretOffset(newCaretOffset)
 
 class ReviewComponent(Component):
@@ -525,7 +529,10 @@
             else:
                 pos = len(string.decode("UTF-8"))
 
-        return [region, offset - pos]
+        if offset >= len(string.decode("UTF-8")):
+            return [None, -1]
+        else:
+            return [region, offset - pos]
 
     def processCursorKey(self, offset):
         """Processes a cursor key press on this Component.  The offset is
@@ -534,7 +541,8 @@
         been scrolled off the display."""
 
         [region, regionOffset] = self.getRegionAtOffset(offset)
-        region.processCursorKey(regionOffset)
+        if region:
+            region.processCursorKey(regionOffset)
 
 def getRegionAtCell(cell):
     """Given a 1-based cell offset, return the braille region
Index: src/orca/braillegenerator.py
===================================================================
--- src/orca/braillegenerator.py	(revision 2389)
+++ src/orca/braillegenerator.py	(working copy)
@@ -744,12 +744,11 @@
 
         regions = []
 
-        textRegion = braille.Text(obj, self._script.getDisplayedLabel(obj))
+        textRegion = braille.Text(obj,
+                                  self._script.getDisplayedLabel(obj),
+                                  " $l")
         regions.append(textRegion)
 
-        eol = braille.Region(" $l")
-        regions.append(eol)
-
         # We do not want the role at the end of text areas.
 
         return [regions, textRegion]
Index: docs/planning.ods
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
