Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

codeofdusk
Copy link
Contributor

@codeofdusk codeofdusk commented Jul 8, 2019

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:

Testing performed:

On Windows 10 1903:

  1. Opened Command Prompt.
  2. Maximized the window.
  3. Changed to the root of the NVDA repository.
  4. Ran git log.
  5. Attempted text review and verified functionality.
  6. Pressed q and verified that automatic readout remained functional.

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.

@codeofdusk codeofdusk changed the base branch from master to beta July 8, 2019 17:39
@codeofdusk
Copy link
Contributor Author

Cc @arfy8820 @feerrenrut @LeonarddeR

@feerrenrut
Copy link
Contributor

Can you clarify the plan for Windows versions prior to 1903?

@codeofdusk
Copy link
Contributor Author

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()
Copy link
Contributor

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.

source/NVDAObjects/UIA/winConsoleUIA.py Outdated Show resolved Hide resolved
@codeofdusk
Copy link
Contributor Author

Superseded by #9735.

@codeofdusk codeofdusk closed this Jul 17, 2019
feerrenrut pushed a commit that referenced this pull request Aug 1, 2019
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI Automation in Windows Console: text review behaves inconsistently when the window is maximized
3 participants