-
-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI Automation in Windows Console: disable some GetVisibleRanges dependent logic when consoles are maximized #9899
Conversation
Can you clarify the plan for Windows versions prior to 1903? |
Testing on 1803 suggests that the bug is less severe there, but this fix does help. |
._rangeObj.getText(-1) | ||
.strip() | ||
.split("\r\n") | ||
) | ||
ptr = self.UIATextPattern.GetVisibleRanges() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs this will return multiple ranges if something is obscuring part of the text (such as a another window in the way). The obscured text will not be returned. In practice this may not be a concern, though an "always on top window" such as speech viewer may interfere.
I wonder if there is another way to get only the text on the current "screen". I haven't investigated this at all, but consider this as a general idea: The number of lines in the console is fixed until the window resizes, after each resize we could count and cache this number of lines. Then when we want all lines on screen we expand a text range from the last line, back n lines. Counting caching the number of lines on a window resize might happen by iterating through the text ranges (per line) checking if it is visible.
40bc982
to
7e9f194
Compare
Superseded by #9735. |
…e checks (PR #9957) Builds on #9614 Supersedes #9735 and #9899 Closes #9891 Previously, after the console window was maximized (or the review cursor is otherwise placed outside the visible text), text review is no longer functional. The review top line and review bottom line scripts do not function as intended. This commit changes: - The isOffscreen property has been implemented as UIAUtils.isTextRangeOffscreen. - When checking if the text range is out of bounds, we now also check that oldRange is in bounds before stopping movement. - Re-implemented POSITION_FIRST and POSITION_LAST in terms of visible ranges.
Link to issue number:
Builds on #9614. Closes #9891.
Summary of the issue:
When consoles are maximized, text review and automatic readout behave incorrectly.
Description of how this pull request fixes the issue:
It appears that
UIATextPattern.GetVisibleRanges
is broken for at least Windows 10 1903 once a console window is maximized, even if later restored. Therefore, for these windows:_getTextLines
now retrieves all text rather than all visible text. This is likely slower.Testing performed:
On Windows 10 1903:
git log
.Testing on Windows 10 1803 suggests that the bug is less severe, but this PR does improve the situation. Since only UIA consoles are impacted by this issue, this PR should not affect legacy consoles.
Known issues with pull request:
None.
Change log entry:
None.