[orca: 1/2] braille: only set viewport[0] to 0 when the string fits



commit afb3f291e83640ee5dc5bff5c1dc4fd115880bdd
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Thu Jul 5 15:58:51 2018 +0200

    braille: only set viewport[0] to 0 when the string fits
    
    93dae3f2c50c ("Fix backspacing text") fixed showing the caret when it is
    exactly one character beyond a string that just fits the output width,
    by avoiding to reset viewport[0] to 0 as soon as the string fits the output
    width, but rather when the cursor fits the output width.
    
    But this has the unwanted effect of doing this also when the line is
    prefixed with some context and the cursor is at the beginning of a line,
    which does not fit entirely in the output width. In that case the prefix
    eats a lot of the output, which would be fine if the line could fit in the
    remaining cells, but that happens also when it does not.
    
    This commit combines both tests, to only reset viewport[0] to 0 when we know
    that the line completely fits (and thus it is not too cumbersome to have
    the context prefix eating some of the output), and that the caret will be
    visible.

 src/orca/braille.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 335272c1a..a745ab8ea 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -1177,7 +1177,8 @@ def refresh(panToCursor=True,
     # right of the display if we need to pan right.
     #
     if panToCursor and (cursorOffset >= 0):
-        if cursorOffset < _displaySize[0]:
+        if len(string) <= _displaySize[0] \
+           and cursorOffset < _displaySize[0]:
             viewport[0] = 0
         elif targetCursorCell:
             viewport[0] = max(0, cursorOffset - targetCursorCell + 1)


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