[orca] Adjust offset for line presentation when caret moves beyond final position



commit ccd6baf67a844c4f00bdbc02522b7fdf1bed0389
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Mar 9 15:17:58 2020 -0400

    Adjust offset for line presentation when caret moves beyond final position
    
    When Orca is not controlling navigation, we can get caret moved events for
    an offset which is beyond the final position when navigating by line. When
    this occurs, adjust the offset to the last valid position so we present
    something.

 src/orca/scripts/web/script_utilities.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index d8fd3020f..b411a764b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1160,6 +1160,11 @@ class Utilities(script_utilities.Utilities):
                 debug.println(debug.LEVEL_INFO, msg, True)
                 return string, start, end
 
+        if boundary == pyatspi.TEXT_BOUNDARY_LINE_START and offset == text.characterCount:
+            offset -= 1
+            msg = "WEB: Line sought for %s at end of text. Adjusting offset to %i." % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg, True)
+
         offset = max(0, offset)
         string, start, end = text.getTextAtOffset(offset, boundary)
 


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