Ui Automation in Windows Console: fix _getTextLines for 21H1 #11760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Supersedes #11722. Fixes #11740 (originally filed upstream as microsoft/terminal#5481). Blocking #10964.
Summary of the issue:
In an old implementation of NVDA's UIA console support, we originally used the standard
_getTextLines
implementation, which calledgetTextInChunks
to get each line from the console according to UIA. This was extremely slow to run over the entire buffer, so we switched to getting all text and callingsplitlines
, which was much faster.In pre-21H1 UIA console, every line ended with a newline character. In 21H1 console, new text can wrap across lines, so every line doesn't necessarily end in a newline. This makes
splitlines
inadequate for 21H1: when text wraps, NVDA starts reading from the beginning of the visible text for every new line of output!Description of how this pull request fixes the issue:
This PR:
_getTextLines
override on the 21H1 UIA console. Pre-21H1 is entirely unaffected.POSITION_LAST
based on a conversation with @carlos-zamora.Testing performed:
Re-tested the case in microsoft/terminal#5481 and verified that it is no longer reproducible.
Known issues with pull request:
Change log entry:
None needed.