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: add STABILIZE_DELAY, only enable UIA when available, limit blank lines in review, make speaking of passwords configurable, improvements to "speak typed words", and initial word movement support #9646

Closed
wants to merge 12 commits into from

Conversation

codeofdusk
Copy link
Contributor

@codeofdusk codeofdusk commented May 31, 2019

Link to issue number:

Builds on #9614.

Summary of the issue:

Currently, in consoles with UI Automation enabled:

  • In object review, commands for moving to and reporting words move to or report lines instead.
  • A large number (thousands in many cases) of empty lines are appended to the console's object review.
  • When "speak typed characters" or "speak typed words" is enabled, typed text that is not displayed onscreen (such as passwords) is still reported.
  • If the advanced setting "force UI Automation in the Windows Console" is enabled on a system without a UIA console (such as Windows versions below Windows 10 1709 or those with the "use legacy console" option selected), the console is completely inaccessible.
  • If "speak typed words" is enabled, the last typed word is announced when pressing enter.
  • When pressing an interrupt character (such as control+c), the _isTyping flag is not cleared on the console, so new text is not announced immediately.

Description of how this pull request fixes the issue:

Word movement and blank line filtering have been implemented in an overridden move method on consoleUIATextInfo. Since the console's UIA implementation does not provide word movement, we must use an offset-based word movement algorithm which uses the Uniscribe API to find word boundaries. The algorithm used for this implementation is based on that in NVDAObjects.offsets._getWordOffsets. Blank lines are filtered by comparing the textInfo's _rangeObj to the last visible text range (returned by winConsoleUIA.UIATextPattern.GetVisibleRanges).

When "speak passwords in UIA consoles" is disabled and one of "speak typed characters" or "speak typed words" is enabled, typedCharacter events are trapped and queued until a textChange event is received. In winConsoleUIA.event_textChange, typed characters are removed from the queue and typedCharacter events are fired. In winConsoleUIA.script_clear_isTyping, this queue is flushed. Since password prompts do not update the screen while the user is typing, no textChange events are received, so no typedCharacter events are fired and therefore no characters are announced.

The legacy console code has been moved to NVDAObjects.IAccessible.winConsoleLegacy, and the check for consoles has been moved from NVDAObjects.window.findOverlayClasses to NVDAObjects.IAccessible.findOverlayClasses. Since NVDA prefers UIA over MSAA, UIA is used when enabled and available and legacy is used otherwise.

The speech.curWordChars buffer is cleared when a typedCharacter of enter or tab is received. This prevents NVDA from speaking partially-typed words (during tab completion) or the last word of a command (when enter is pressed). This approach will need to be modified once #8110 is merged, as it significantly changes handling of typed words.

The interrupt characters control+c, control+d, and control+break have been bound to the script_clear_isTyping script on NVDAObjects.UIA.winConsoleUIA.

Testing performed:

Tested password entry (by authenticating with ssh), text review, and all combinations of the "use legacy console" and UIA checkboxes on Windows 10 versions 1803 and 1903.

Known issues with pull request:

  • While "review previous word" and "review next word" now allow word movement, the cursor is not consistently placed on the first character of the word under review.
  • When "speak passwords in UIA consoles" is disabled and one of "speak typed characters" or "speak typed words" is enabled, typedCharacter events are only dispatched once textChange is received. This may introduce a small performance penalty.
  • Reporting of text selection is incorrect on Windows 10 version 1809 and earlier.
  • After all characters of the input line have been deleted, further presses of backspace read the last character of the output line.
  • When reviewing to the last line of the console, the review cursor may become stuck. When this happens, it is impossible to review text in the console until moving focus away from the window and back again.
  • Sometimes, attempting to interact with the console too quickly after focusing the window can make NVDA unable to get any caret or review information or receive new text events. To work around this, move focus away from the window and back again.
  • In console applications that update the screen while the user is typing (i.e. before winConsoleUIA._isTyping is cleared), reporting of new text and speak typed words may not function correctly.

Change log entry:

None.

codeofdusk added 12 commits May 30, 2019 22:09
…legacy consoles).

This helps NVDA process large amounts of text.
Note: there are issues when reaching the bottom of the review (cursor gets stuck).
This should mostly restore caret movement support.
This approach works on my system, but needs wider testing.
…ffer when enter or tab is pressed.

Note: this will need to be investigated once nvaccess#8110 is merged.
…xtInfo._getCurrentOffset. The reverse option has been removed.
@michaelDCurran
Copy link
Member

Could you please replace this pr with smaller specific prs please? Perhaps one that handles blank lines / move by words (as that is all changes to a TextInfo). Then one for UIA when available (I.e. moving winConsole to IAccessible etc), and finally one for speak typed characters/words. It makes it a lot easier to describe the specific issue in the pr, and easier to review.

@LeonarddeR
Copy link
Collaborator

Since you're now replacing this with smaller ones,I'm closing this one.

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.

3 participants