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

when speak typed words feature is on, pressing the spacebar sometimes wrongly announces words #4308

Closed
nvaccessAuto opened this issue Jul 18, 2014 · 16 comments

Comments

@nvaccessAuto
Copy link

Reported by blindbhavya on 2014-07-18 11:14
Let me give you the example of a simple English word.
Note : This issue is inconsistent and may or may not work in all cases. However, the following steps to reproduce worked on two machines successfully (running Windows 7 Ultimate & Starter respectively).
Steps to reproduce
Press Windows + R to launch the Windows Run dialog box.
Ensure that the speak typed words feature is enabled (NVDA + 3).
Type the word 'incredulous' in the Run dialog box and press the Spacebar.
NVDA should say encredulous.
I repeat that this issue is not consistent and till now I have found that the word 'incredulous' is mispronounced in some cases.
Blocking #4613

@nvaccessAuto
Copy link
Author

Comment 1 by blindbhavya on 2014-07-18 11:16
Hi.
This issue is there with other words as well but don't exactly remember which ones.
I have tested this bug with ESpeak and Microsoft Sapi 5 speech synthesizers.

@nvaccessAuto
Copy link
Author

Comment 2 by blindbhavya on 2014-07-18 11:25
Hi.
I will keep adding new comments as I discover this issue lying with other words.
1 I have tested many other words with the same steps to reproduce starting with 'in' and NVDA always says en instead of in.
2 In some cases when the word is typed and the Spacebar is pressed and one presses Shift + Ctrl + left arrow (select previous i.e. recently typed word), and then writes something (like and) NVDA will miss the first alphabet of the newly typed word, in our case NVDA will say 'nd'.
Actually, I am finding many more instances where NVDA mispronounces the typed word. Please can you'll (the developers) experiment with it to understand where NVDA mispronounces and where it doesn't?
P.S. I have typed all of the above words which have issues in the Run dialog box so I request you to do the same to reproduce the above issues, and find more instances where this issue is present.

@nvaccessAuto
Copy link
Author

Comment 3 by briang1 on 2014-07-18 16:05
Do any of these happen if using Espeak?

I ask as I've not heard any of this. Admitedly, if you correct a word or move about inside it and the hit space at the end, you will hear some odd words, as its merely reading it from where it was altered. This used to happen in my old screenreader as well though, so I'd not bothered with it as a problem.

@nvaccessAuto
Copy link
Author

Comment 4 by blindbhavya on 2014-07-18 16:12
Hi.
Yes this issue does happen with ESpeak. I think I did mention testing these issues with both ESpeak Microsoft Sapi 5.

@nvaccessAuto
Copy link
Author

Comment 5 by jteh on 2014-07-21 08:31
Confirmed. This occurs because speak typed words is currently based entirely on speech output. Speak typed words considers any character typed since the last utterance of other speech. Unfortunately, taking the Run dialog example, when you type the first character, that causes the previous selection to be removed, which is an utterance, so speak typed words then gets reset and only includes characters from the second onwards. I think the only way we could fix this would be to actually query the text itself for speak typed words.

@nvaccessAuto
Copy link
Author

Comment 6 by blindbhavya on 2014-07-21 14:44
Ok. Hope this may be fixed soon.
Also, if and when this issue is fixed do send me the exact link to download the snapshot with this improvement.
So that I can give further suggestions (if required).

@nvaccessAuto
Copy link
Author

Comment 7 by blindbhavya on 2014-09-11 15:42
Hi.
It would be nice if someone could work on this ticket.
Just reminding since quite a few new devs have turned up recently.
Please do not comment if no one turns up to volunteer.
Thanks a lot.

@nvaccessAuto
Copy link
Author

Attachment 2015-02-25 13-10.log added by cassonw on 2015-02-25 21:33
Description:
Demonstrates the behavior when text is selected and the user starts typing a new word

@nvaccessAuto
Copy link
Author

Attachment 2015-02-25 13-30.log added by cassonw on 2015-02-25 21:36
Description:
This log demonstrates that the announcement that states selection removed does not occur even when the delete key is pressed until the user types another key.

@nvaccessAuto
Copy link
Author

Comment 9 by cassonw on 2015-02-25 21:48
Looking at the log files, it looks like the order that NVDA is announcing the "selection removed" text is after a key is pressed when overwriting highlighted text. When the user selects text and then starts typing, the announcement about selection removed is occurring after the user types the first key. This is probably clearing the buffer so that when the user presses space, it only speaks the word without the first letter. The other condition that this occurs in is also when the user has selected text. Even if the user presses the delete key to clear the highlighted text, NVDA does not announce that the selection removed when the delete key is pressed but when the user presses another key. If this key is the first letter of the new word, it will not be part of the spoken word when the space key is pressed. I have attached debug logs that exhibit both conditions.

@nvaccessAuto
Copy link
Author

Comment 11 by driemer.riemer@... on 2015-02-26 00:20
I think the issue lies within the speech.speak function.

if not speechSequence: #Pointless - nothing to speak 
        return
    import speechViewer
    if speechViewer.isActive:
        for item in speechSequence:
            if isinstance(item,basestring):
                speechViewer.appendText(item)
    global beenCanceled, curWordChars
    curWordChars=[speechMode==speechMode_off:
    ...
curWordChars=[](]
if) is where the problem is.

The solution I would propose, (if someone has a better idea, let me know), is to use the controlTypes.REASON_* constants. I would propose creating a controlTypes.REASON_SELECTION_REMOVED constant, and changing the definition of speak as such.

#currently we have
def speak(speechSequence,symbolLevel=None):
#I would change it to
def speak(speechSequence,symbolLevel=None, reason=None):

Then we can do something like

if reason is None:
    #flush the buffer. 
    curWordChars=[]

This requires changing the definition, which isn't quite ideal so if a better solution exists, let me know. It also looks like speech.speakMessage currently does nothing with controlTypes.REASON_* constants. If so, is there a need for them or is it just kind of there so it makes calls to speakMessage more easy to understand programaticly?

@nvaccessAuto
Copy link
Author

Attachment 0001-fixed-t4308-Nvda-no-longer-should-omit-the-first-cha.patch added by driemer.riemer@... on 2015-02-26 01:34
Description:
Patch. This should fix the issue.

@nvaccessAuto
Copy link
Author

Comment 13 by driemer.riemer@... on 2015-02-26 03:04
Just to note, I added a patch. This should be do for code-review.

@nvaccessAuto
Copy link
Author

Comment 14 by driemer.riemer@... on 2015-03-24 17:19
Hi,
Please remember to add "needs code review" to the keywords for this so that it doesn't get forgotten.
Thanks.

@bhavyashah
Copy link

@jcsteh Just a friendly reminder to review this more than 2-year-old code submission.

@jcsteh
Copy link
Contributor

jcsteh commented Aug 7, 2017

Here's the patch from Trac.

@derekriemer, thanks for the patch. While this will indeed fix this particular case, the problem is that there are a lot of other cases it doesn't address; e.g. start typing a word, press NVDA+f12 to report the time, press space and you'll get no word. We really need to find a better place to clear curWordChars or, better still, get the word from the application.

Closing as a duplicate of #1259, which was missed when this was filed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants