[orca] Braille: Take the target cell into account when adjusting for word wrap



commit f6a34af1bf49832c6715d9b34adeefca0a750d99
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Apr 24 12:07:51 2020 -0400

    Braille: Take the target cell into account when adjusting for word wrap
    
    Failure to take the target cursor cell into account when adjusting
    for word wrap can lead to our failing to display that position until
    the user explicitly pans to it.

 src/orca/braille.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index cc98058d7..01db759a2 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -1192,7 +1192,7 @@ def refresh(panToCursor=True,
             if cursorOffset >= (viewport[0] + _displaySize[0]):
                 viewport[0] = max(0, cursorOffset - _displaySize[0] + 1)
 
-    startPos, endPos = _adjustForWordWrap()
+    startPos, endPos = _adjustForWordWrap(targetCursorCell)
     viewport[0] = startPos
 
     # Now normalize the cursor position to BrlTTY, which uses 1 as
@@ -1413,10 +1413,10 @@ def displayKeyEvent(event):
         msg = "%s %s" % (keyname, lockingStateString)
         displayMessage(msg, flashTime=settings.brailleFlashTime)
 
-def _adjustForWordWrap():
+def _adjustForWordWrap(targetCursorCell):
     startPos = viewport[0]
     endPos = startPos + _displaySize[0]
-    msg = "BRAILLE: Current range: (%i, %i)." % (startPos, endPos)
+    msg = "BRAILLE: Current range: (%i, %i). Target cell: %i." % (startPos, endPos, targetCursorCell)
     debug.println(debug.LEVEL_INFO, msg, True)
 
     if not _lines or not settings.enableBrailleWordWrap:
@@ -1424,7 +1424,7 @@ def _adjustForWordWrap():
 
     line = _lines[viewport[1]]
     lineString, focusOffset, attributeMask, ranges = line.getLineInfo()
-    ranges = list(filter(lambda x: x[0] <= startPos < x[1], ranges))
+    ranges = list(filter(lambda x: x[0] <= startPos + targetCursorCell < x[1], ranges))
     if ranges:
         msg = "BRAILLE: Adjusted range: (%i, %i)" % (ranges[0][0], ranges[-1][1])
         debug.println(debug.LEVEL_INFO, msg, True)


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