Index: src/orca/Gecko.py
===================================================================
--- src/orca/Gecko.py	(revision 3402)
+++ src/orca/Gecko.py	(working copy)
@@ -5764,6 +5764,9 @@
         if text:
             [textAfterOffset, start, end] = text.getTextAfterOffset(offset,
                                                                     boundary)
+            if textAfterOffset and textAfterOffset[-1] == " ":
+                textAfterOffset = textAfterOffset[0:len(textAfterOffset)-1]
+                end -= 1
         else:
             textAfterOffset = ""
             start = 0
@@ -5771,13 +5774,16 @@
         objects.append([obj, start, end])
 
         pattern = re.compile(self.EMBEDDED_OBJECT_CHARACTER)
-        matches = re.finditer(pattern, textAfterOffset.decode("UTF-8"))
+        unicodeText = textAfterOffset.decode("UTF-8")
+        matches = re.finditer(pattern, unicodeText)
         for m in matches:
             # Adjust the last object's endOffset to the last character
-            # before the EOC.
+            # before the EOC. Also check to see if we have a space to
+            # strip out.
             #
             childOffset = m.start(0) + start
-            objects[-1][2] = childOffset
+            adjustment = int(unicodeText[m.start(0) - 1] == " ")
+            objects[-1][2] = childOffset - adjustment
             if objects[-1][1] == objects[-1][2]:
                 # A zero-length object is an indication of something
                 # whose sole contents was an EOC.  Delete it from the
@@ -5797,7 +5803,7 @@
             #
             if end > childOffset + 1:
                 objects.append([obj, childOffset + 1, end])
-                
+
         return objects
 
     def guessLabelFromLine(self, obj):
@@ -6379,6 +6385,14 @@
         if text and not (self.isAriaWidget(obj) 
                          and obj.getRole() == pyatspi.ROLE_LIST):
             unicodeText = self.getUnicodeText(obj)
+
+            # We now seem to be getting a final space when the line ends with
+            # an embedded object character.  Strip it off.
+            #
+            if (unicodeText[-1] == " ") \
+               and (unicodeText[-2] == self.EMBEDDED_OBJECT_CHARACTER):
+                unicodeText = unicodeText.strip()
+
             nextOffset = startOffset + 1
             while nextOffset < len(unicodeText):
                 if unicodeText[nextOffset] != self.EMBEDDED_OBJECT_CHARACTER:
@@ -6470,6 +6484,14 @@
         if text and not (self.isAriaWidget(obj) \
                          and obj.getRole() == pyatspi.ROLE_LIST):
             unicodeText = self.getUnicodeText(obj)
+
+            # We now seem to be getting a final space when the line ends with
+            # an embedded object character.  Strip it off.
+            #
+            if (unicodeText[-1] == " ") \
+               and (unicodeText[-2] == self.EMBEDDED_OBJECT_CHARACTER):
+                unicodeText = unicodeText.strip()
+
             if (startOffset == -1) or (startOffset > len(unicodeText)):
                 startOffset = len(unicodeText)
             previousOffset = startOffset - 1
