@@ -1769,7 +1769,7 @@ def __init__(self, handler):
17691769 #: The translated braille representation of the entire buffer.
17701770 #: @type: [int, ...]
17711771 self .brailleCells = []
1772- self ._windowRowBufferOffsets : list [tuple [int , int ]] = [(0 , 1 )]
1772+ self ._windowRowBufferOffsets : list [tuple [int , int ]] = [(0 , 0 )]
17731773 """
17741774 A list representing the rows in the braille window,
17751775 each item being a tuple of start and end braille buffer offsets.
@@ -1879,6 +1879,8 @@ def windowPosToBufferPos(self, windowPos: int) -> int:
18791879 """
18801880 Converts a position relative to the braille window to a position relative to the braille buffer.
18811881 """
1882+ if self .handler .displaySize == 0 :
1883+ return 0
18821884 windowPos = max (min (windowPos , self .handler .displaySize ), 0 )
18831885 row , col = divmod (windowPos , self .handler .displayDimensions .numCols )
18841886 if row < len (self ._windowRowBufferOffsets ):
@@ -1905,7 +1907,7 @@ def _calculateWindowRowBufferOffsets(self, pos: int) -> None:
19051907 self ._windowRowBufferOffsets .clear ()
19061908 if len (self .brailleCells ) == 0 :
19071909 # Initialising with no actual braille content.
1908- self ._windowRowBufferOffsets = [(0 , 1 )]
1910+ self ._windowRowBufferOffsets = [(0 , 0 )]
19091911 return
19101912 doWordWrap = config .conf ["braille" ]["wordWrap" ]
19111913 bufferEnd = len (self .brailleCells )
@@ -2539,9 +2541,14 @@ def _set_displaySize(self, value):
25392541 _cache_displayDimensions = True
25402542
25412543 def _get_displayDimensions (self ) -> DisplayDimensions :
2544+ if not self .display :
2545+ numRows = numCols = 0
2546+ else :
2547+ numRows = self .display .numRows
2548+ numCols = self .display .numCols if numRows > 1 else self .display .numCells
25422549 rawDisplayDimensions = DisplayDimensions (
2543- numRows = self . display . numRows if self . display else 0 ,
2544- numCols = self . display . numCols if self . display else 0 ,
2550+ numRows = numRows ,
2551+ numCols = numCols ,
25452552 )
25462553 filteredDisplayDimensions = filter_displayDimensions .apply (rawDisplayDimensions )
25472554 # Would be nice if there were a more official way to find out if the displaySize filter is currently registered by at least 1 handler.
@@ -3284,7 +3291,9 @@ class BrailleDisplayDriver(driverHandler.Driver):
32843291 containing a BrailleDisplayDriver class which inherits from this base class.
32853292
32863293 At a minimum, drivers must set L{name} and L{description} and override the L{check} method.
3287- To display braille, L{numCells} and L{display} must be implemented.
3294+ To display braille, L{display} must be implemented.
3295+ For a single line display, L{numCells} must be implemented.
3296+ For a multi line display, L{numRows} and L{numCols} must be implemented.
32883297
32893298 To support automatic detection of braille displays belonging to this driver:
32903299 * The driver must be thread safe and L{isThreadSafe} should be set to C{True}
0 commit comments