Skip to content

Only clear curWordChars on focus / caret movement - #9597

Merged
michaelDCurran merged 2 commits into
thresholdfrom
i9577
May 20, 2019
Merged

Only clear curWordChars on focus / caret movement#9597
michaelDCurran merged 2 commits into
thresholdfrom
i9577

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

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:

  • typed "ding dong ". NVDA announced "d i n g ding space d o n g dong space"
    In Notepad with speak typed characters off and speak typed words on:
  • Typed "ding" and pressed leftArrow until moving before the "o" and then typed "dong ". NVDA announced "dong".
  • Typed "ding" alt+tabbed to Thunderbird and back again, then typed "dong ". NVDA announced "dong".

Known issues with pull request:

None.

Change log entry:

None.

@michaelDCurran
michaelDCurran requested a review from LeonarddeR May 20, 2019 07:10

@LeonarddeR LeonarddeR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/speech.py Outdated
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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@michaelDCurran
michaelDCurran merged commit a9aca98 into threshold May 20, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.2 milestone May 20, 2019
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