@@ -48,10 +48,8 @@ def _getBoundingRange(self, obj, position):
4848 if position == textInfos .POSITION_FIRST :
4949 collapseToEnd = False
5050 elif position == textInfos .POSITION_LAST :
51- # We must pull back the end by one character otherwise when we collapse to end,
52- # a console bug results in a textRange covering the entire console buffer!
53- # Strangely the *very* last character is a special blank point
54- # so we never seem to miss a real character.
51+ # The exclusive end hangs off the end of the visible ranges.
52+ # Move back one character to remain within bounds.
5553 _rangeObj .MoveEndpointByUnit (
5654 UIAHandler .TextPatternRangeEndpoint_End ,
5755 UIAHandler .NVDAUnitsToUIAUnits ['character' ],
@@ -366,13 +364,19 @@ def _get_TextInfo(self):
366364 return consoleUIATextInfo if self .is21H1Plus else consoleUIATextInfoPre21H1
367365
368366 def _getTextLines (self ):
367+ if self .is21H1Plus :
368+ # #11760: the 21H1 UIA console wraps across lines.
369+ # When text wraps, NVDA starts reading from the beginning of the visible text for every new line of output.
370+ # Use the superclass _getTextLines instead.
371+ return super ()._getTextLines ()
369372 # This override of _getTextLines takes advantage of the fact that
370373 # the console text contains linefeeds for every line
371374 # Thus a simple string splitlines is much faster than splitting by unit line.
372375 ti = self .makeTextInfo (textInfos .POSITION_ALL )
373376 text = ti .text or ""
374377 return text .splitlines ()
375378
379+
376380 def detectPossibleSelectionChange (self ):
377381 try :
378382 return super ().detectPossibleSelectionChange ()
0 commit comments