Only clear curWordChars on focus / caret movement - #9597
Merged
Conversation
…s and caret movement.
LeonarddeR
approved these changes
May 20, 2019
LeonarddeR
left a comment
Collaborator
There was a problem hiding this comment.
There might still be some edge cases we haven't covered yet, but I'm sure the'll pop up later.
Re #7812, this is not entirely fixed because when the focus is at a cell and you press a letter, the focus changes and that clears the buffer. I guess we could fix that by explicitly overriding event_loseFocus on Excel Cells.
| def clearTypedWordBuffer(): | ||
| """ | ||
| Forgets any word currently being built up with typed characters for speaking. | ||
| This should be called when the user's context changes such that they could no longer complete the word (such as a focus change or choosing to move the caret). |
Collaborator
There was a problem hiding this comment.
Line split:
Suggested change
| This should be called when the user's context changes such that they could no longer complete the word (such as a focus change or choosing to move the caret). | |
| This should be called when the user's context changes such that they could no longer | |
| complete the word (such as a focus change or choosing to move the caret). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Fixes #9577
May partly address #7000 812
Summary of the issue:
Since speech refactor, typing a word and pressing space, with speak typed characters and speak typed words on, NVDA only announces the characters (including the space) and not the typed word. It is supposed to announce the typed word and then the space.
speech.speak currently clears curWordChars, forgetting the currently typed word every time it is called. This was originally done so that most speech would forget the current word as it was most probable that the user was performing an unrelated action. Yet, because speech.speakSpelling did not call speech.speak (rather it called speak on the synth directly) typing further chracters did not cause curWordCars to be cleared.
However, speech refactor changed speech.speakSpelling to call speech.speak, which then means that curWordChars is always cleared every time a typed character is spoken, and the word is never built up.
Description of how this pull request fixes the issue:
speech.speak no longer clears curWordChars. Rather a new clearTypedWordBuffer function has been added to speak which does this, and is called from event_loseFocus on the base NvDAObject and EditableText's _caretMovementScriptHelper method, essentially forgetting the current word for every focus change and user-initiated caret move.
Testing performed:
In Notepad with speak typed characters on and speak typed words on:
In Notepad with speak typed characters off and speak typed words on:
Known issues with pull request:
None.
Change log entry:
None.