[orca] Fix issue where "blank" was not being spoken for a blank line



commit 662fbf6c608f1c3f412282226b1621caa591a31d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jan 3 05:38:46 2017 -0500

    Fix issue where "blank" was not being spoken for a blank line

 src/orca/scripts/web/script_utilities.py |    8 ++++++++
 src/orca/speech_generator.py             |   10 ++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9abaea7..b2043da 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2788,6 +2788,14 @@ class Utilities(script_utilities.Utilities):
 
         if state.contains(pyatspi.STATE_EDITABLE):
             rv = childCount > 0 or self.isLink(obj)
+            if not rv and "EditableText" in pyatspi.listInterfaces(obj):
+                try:
+                    string = obj.queryText().getText(0, -1)
+                except:
+                    msg = "WEB: Exception getting text for %s" % obj
+                    debug.println(debug.LEVEL_INFO, msg, True)
+                else:
+                    rv = string == ""
 
         self._isContentEditableWithEmbeddedObjects[hash(obj)] = rv
         return rv
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 0102faa..43145a9 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -968,7 +968,7 @@ class SpeechGenerator(generator.Generator):
         acss = self.voice(DEFAULT)
         result = generator.Generator._generateCurrentLineText(self, obj, **args)
         if result:
-            if result == ["\n"]:
+            if result == ['\n'] and _settingsManager.getSetting('speakBlankLines'):
                 result = [messages.BLANK]
             result.extend(acss)
         return result
@@ -1081,9 +1081,8 @@ class SpeechGenerator(generator.Generator):
             else:
                 char = textObj.getTextAtOffset(caretOffset,
                     pyatspi.TEXT_BOUNDARY_CHAR)
-                if char[0] == "\n" and startOffset == caretOffset \
-                       and _settingsManager.getSetting('speakBlankLines'):
-                    textContents = (messages.BLANK)
+                if char[0] == "\n" and startOffset == caretOffset:
+                    textContents = char[0]
 
         self._script.generatorCache['textInformation'] = \
             [textContents, startOffset, endOffset, selected]
@@ -1224,6 +1223,9 @@ class SpeechGenerator(generator.Generator):
             result[0] = result[0].strip()
 
         result.extend(self._getACSS(obj, result[0]))
+        if result[0] in ['\n', ''] and _settingsManager.getSetting('speakBlankLines'):
+            result[0] = messages.BLANK
+
         return result
 
     def _generateTextIndentation(self, obj, **args):


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