From 333d9ee9329c957662c3f8246b1ae95e2aea4e57 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Fri, 2 Oct 2020 18:13:18 -0400 Subject: [PATCH 1/2] Fix _getTextLines for 21H1 UIA console --- source/NVDAObjects/UIA/winConsoleUIA.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/NVDAObjects/UIA/winConsoleUIA.py b/source/NVDAObjects/UIA/winConsoleUIA.py index 3e3b8f186c1..64dae4a9421 100644 --- a/source/NVDAObjects/UIA/winConsoleUIA.py +++ b/source/NVDAObjects/UIA/winConsoleUIA.py @@ -48,10 +48,8 @@ def _getBoundingRange(self, obj, position): if position == textInfos.POSITION_FIRST: collapseToEnd = False elif position == textInfos.POSITION_LAST: - # We must pull back the end by one character otherwise when we collapse to end, - # a console bug results in a textRange covering the entire console buffer! - # Strangely the *very* last character is a special blank point - # so we never seem to miss a real character. + # The exclusive end hangs off the end of the visible ranges. + # Move back one character to remain within bounds. _rangeObj.MoveEndpointByUnit( UIAHandler.TextPatternRangeEndpoint_End, UIAHandler.NVDAUnitsToUIAUnits['character'], @@ -366,6 +364,11 @@ def _get_TextInfo(self): return consoleUIATextInfo if self.is21H1Plus else consoleUIATextInfoPre21H1 def _getTextLines(self): + if self.is21H1Plus: + # #11722: the 21H1 UIA console wraps across lines. + # When text wraps, NVDA starts reading from the beginning of the visible text for every new line of output. + # Use the superclass _getTextLines instead. + return super()._getTextLines() # This override of _getTextLines takes advantage of the fact that # the console text contains linefeeds for every line # Thus a simple string splitlines is much faster than splitting by unit line. @@ -373,6 +376,7 @@ def _getTextLines(self): text = ti.text or "" return text.splitlines() + def detectPossibleSelectionChange(self): try: return super().detectPossibleSelectionChange() From aa1238e2c65cd6aad04cb3ad46315a1d906e6388 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 14 Oct 2020 12:40:31 -0400 Subject: [PATCH 2/2] Fix comment. --- source/NVDAObjects/UIA/winConsoleUIA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/NVDAObjects/UIA/winConsoleUIA.py b/source/NVDAObjects/UIA/winConsoleUIA.py index 64dae4a9421..03513bf48f1 100644 --- a/source/NVDAObjects/UIA/winConsoleUIA.py +++ b/source/NVDAObjects/UIA/winConsoleUIA.py @@ -365,7 +365,7 @@ def _get_TextInfo(self): def _getTextLines(self): if self.is21H1Plus: - # #11722: the 21H1 UIA console wraps across lines. + # #11760: the 21H1 UIA console wraps across lines. # When text wraps, NVDA starts reading from the beginning of the visible text for every new line of output. # Use the superclass _getTextLines instead. return super()._getTextLines()