[orca] Present full line when caret moves to same-page link



commit b2e9844471335175b597e63be70f7166ec874b2f
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Jan 30 18:41:52 2020 -0500

    Present full line when caret moves to same-page link

 src/orca/scripts/web/script.py           | 5 +++++
 src/orca/scripts/web/script_utilities.py | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 2717cb653..7a5be6a43 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1236,6 +1236,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             contents = self.utilities.getObjectContentsAtOffset(newFocus, 0)
             utterances = self.speechGenerator.generateContents(contents)
+        elif self.utilities.caretMovedToSamePageFragment(event, oldFocus):
+            msg = "WEB: Event source %s is same page fragment. Generating line contents." % event.source
+            debug.println(debug.LEVEL_INFO, msg, True)
+            contents = self.utilities.getLineContentsAtOffset(newFocus, 0)
+            utterances = self.speechGenerator.generateContents(contents)
         else:
             msg = "WEB: New focus %s is not a special case. Generating speech." % newFocus
             debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index af8f20b86..796d88b50 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4020,14 +4020,15 @@ class Utilities(script_utilities.Utilities):
 
         return False
 
-    def caretMovedToSamePageFragment(self, event):
+    def caretMovedToSamePageFragment(self, event, oldFocus=None):
         if not event.type.startswith("object:text-caret-moved"):
             return False
 
         if event.source.getState().contains(pyatspi.STATE_EDITABLE):
             return False
 
-        linkURI = self.uri(orca_state.locusOfFocus)
+        oldFocus = oldFocus or orca_state.locusOfFocus
+        linkURI = self.uri(oldFocus)
         docURI = self.documentFrameURI()
         if linkURI == docURI:
             return True


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