[orca] Fix presentation of newly-misspelled words in LibreOffice Writer



commit e81dee9e0335baff14b0821b870b2d3c2358f671
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Jun 6 14:51:26 2015 -0400

    Fix presentation of newly-misspelled words in LibreOffice Writer
    
    * Remove the hack we had for a LibreOffice bug fixed in LO 4.3
    * Don't bother getting the words at offset; just check offsets

 src/orca/scripts/apps/soffice/script.py |   14 --------------
 src/orca/scripts/default.py             |   16 +++++-----------
 2 files changed, 5 insertions(+), 25 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index c0e0a84..f317a84 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -985,20 +985,6 @@ class Script(default.Script):
         # We're seeing a crazy ton of these emitted bogusly.
         pass
 
-    def onTextAttributesChanged(self, event):
-        """Callback for object:text-attributes-changed accessibility events."""
-
-        # LibreOffice emits this signal nearly every time text is typed,
-        # even though the text attributes haven't changed:
-        # https://bugs.freedesktop.org/show_bug.cgi?id=71556
-
-        # LibreOffice fails to emit this signal the main time we are looking
-        # for it, namely to present that a misspelled word was typed:
-        # https://bugs.freedesktop.org/show_bug.cgi?id=71558
-
-        # Useless signals are useless.
-        pass
-
     def getTextLineAtCaret(self, obj, offset=None, startOffset=None, endOffset=None):
         """To-be-removed. Returns the string, caretOffset, startOffset."""
 
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index ec001f9..c060fd6 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2517,17 +2517,11 @@ class Script(script.Script):
             # check the previous word (most likely case) and the next
             # word with respect to the current position.
             #
-            prevWordAndOffsets = \
-                text.getTextAtOffset(text.caretOffset - 1,
-                                     pyatspi.TEXT_BOUNDARY_WORD_START)
-            nextWordAndOffsets = \
-                text.getTextAtOffset(text.caretOffset + 1,
-                                     pyatspi.TEXT_BOUNDARY_WORD_START)
-
-            if self.utilities.isWordMisspelled(
-                    event.source, prevWordAndOffsets[1] ) \
-               or self.utilities.isWordMisspelled(
-                    event.source, nextWordAndOffsets[1]):
+            offset = text.caretOffset
+            if not text.getText(offset, offset+1).isalnum():
+                offset -= 1
+            if self.utilities.isWordMisspelled(event.source, offset-1) \
+               or self.utilities.isWordMisspelled(event.source, offset+1):
                 self.speakMessage(messages.MISSPELLED)
 
     def onTextDeleted(self, event):


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