Topics

Speech handling with textinfo objects.


Pawel Urbanski
 

Dear Friends,
I'm writing over here for it seems to be a bit more difficult case.
While working on refactoring my VS Code add-on, I stummbled on the
following case:
1. I use event_caret and event_focus on editable text, which is the code area.
2. Create textInfos object using position selection to get line start
and end offsets.
3. I use start offset to check if I am in teh sme line.
4. The offset changes are correct, which I check in multiple places by
logging values.
5. When I am in teh same line and typing, I want to cancel speech so
to not hear what I typed already - I know it well.
6. Here is the problem:
The first 2 or 3 characters located at the beginning of the line are
being briefly annouced and rappidly canceled.
I placed speech.cancelSpeech() calls step by step in different places
of the code, which does not change the result.
Here is the example code to give you some idea:
if oldStartOffset == currentStartOffset:
speech.cancelSpeech()
I also tried:
braille.handler.update()
speech.speakTextInfo() with diffrent parameters, including suppressing
blanks and passing just the single end of line character.
Unfortunately, that very short and annoying fragment is kept being announced.

Any hints about better way to debug it or log in some aprticular way
would be appriciated.

Thanks alot in advance...
Pawel


Pawel Urbanski
 

Sending an update, which I hope may help with helping me with the
answer for the question I posted in teh previous message.
I had another debugging session and logging the speech category. Here
is the output:
IO - speech.speak (15:25:39.132) - MainThread (8236):
Speaking ['\x00', # it is an empty character for a role I want to be silent
CancellableSpeech (still valid devInfo(
isCanceledCache: False, # What does it mean?
isValidCallback: True, # What does it mean?
isValidCallbackDevInfo: ), # Seems to have no value.
' IDBFactory.apply.arguments\n'] # The line from the editor.

As I said before the problem is as follows:
When I compare start offsets fo teh line and want to cancel speech
when they are the same, NVDA keeps reading the first character of that
line and breaks speech as if there was some kind of delay.
It takes place even when I am in teh same line and add more completions.
Additional information:
Whenever teh completion list in Visual Studio Code shows up the main
editor loses focus and gains it back once completion is inserted.
I read line by line the log output from speech manager and lokks like
all the pending speech commands are cleared in the doPreFocusEvent or
however exactly is called that function.

Any help will be appriciated..

Best,
Pawel

On 29/11/2020, Pawel Urbanski via groups.io
<pawel=e-urbanski.com@groups.io> wrote:
Dear Friends,
I'm writing over here for it seems to be a bit more difficult case.
While working on refactoring my VS Code add-on, I stummbled on the
following case:
1. I use event_caret and event_focus on editable text, which is the code
area.
2. Create textInfos object using position selection to get line start
and end offsets.
3. I use start offset to check if I am in teh sme line.
4. The offset changes are correct, which I check in multiple places by
logging values.
5. When I am in teh same line and typing, I want to cancel speech so
to not hear what I typed already - I know it well.
6. Here is the problem:
The first 2 or 3 characters located at the beginning of the line are
being briefly annouced and rappidly canceled.
I placed speech.cancelSpeech() calls step by step in different places
of the code, which does not change the result.
Here is the example code to give you some idea:
if oldStartOffset == currentStartOffset:
speech.cancelSpeech()
I also tried:
braille.handler.update()
speech.speakTextInfo() with diffrent parameters, including suppressing
blanks and passing just the single end of line character.
Unfortunately, that very short and annoying fragment is kept being
announced.

Any hints about better way to debug it or log in some aprticular way
would be appriciated.

Thanks alot in advance...
Pawel






Reef Turner
 

You'll need to provide more information. It isn't clear to me what you are trying to do.

The logging for that CancellableSpeechCommand is telling you that it is still valid, ie not cancelled. These commands are intended to allow dynamically cancelling individual utterances when new information becomes available.

It sounds like you might be trying to prevent certain speech from being spoken at all under some conditions?

Reef Turner
Software Developer - NV Access


On Tue, 1 Dec 2020 at 22:45, Pawel Urbanski <pawel@...> wrote:
Sending an update, which I hope may help with helping me with the
answer for the question I posted in teh previous message.
I had another debugging session and logging the speech category. Here
is the output:
IO - speech.speak (15:25:39.132) - MainThread (8236):
Speaking ['\x00', # it is an empty character for a role I want to be silent
CancellableSpeech (still valid devInfo(
isCanceledCache: False, # What does it mean?
 isValidCallback: True, # What does it mean?
isValidCallbackDevInfo:  ), # Seems to have no value.
 '    IDBFactory.apply.arguments\n'] # The line from the editor.

As I said before the problem is as follows:
When I compare start offsets fo teh line and want to cancel speech
when they are the same, NVDA keeps reading the first character of that
line and breaks speech as if there was some kind of delay.
It takes place even when I am in teh same line and add more completions.
Additional information:
Whenever teh completion list in Visual Studio Code shows up the main
editor loses focus and gains it back once completion is inserted.
I read line by line the log output from speech manager and lokks like
all the pending speech commands are cleared in the doPreFocusEvent or
however exactly is called that function.

Any help will be appriciated..

Best,
Pawel

On 29/11/2020, Pawel Urbanski via groups.io
<pawel=e-urbanski.com@groups.io> wrote:
> Dear Friends,
> I'm writing over here for it seems to be a bit more difficult case.
> While working on refactoring my VS Code add-on, I stummbled on the
> following case:
> 1. I use event_caret and event_focus on editable text, which is the code
> area.
> 2. Create textInfos object using position selection to get line start
> and end offsets.
> 3. I use start offset to check if I am in teh sme line.
> 4. The offset changes are correct, which I check in multiple places by
> logging values.
> 5. When I am in teh same line and typing, I want to cancel speech so
> to not hear what I typed already - I know it well.
> 6. Here is the problem:
> The first 2 or 3 characters located at the beginning of the line are
> being briefly annouced and rappidly canceled.
> I placed speech.cancelSpeech() calls step by step in different places
> of the code, which does not change the result.
> Here is the example code to give you some idea:
> if oldStartOffset == currentStartOffset:
> speech.cancelSpeech()
> I also tried:
> braille.handler.update()
> speech.speakTextInfo() with diffrent parameters, including suppressing
> blanks and passing just the single end of line character.
> Unfortunately, that very short and annoying fragment is kept being
> announced.
>
> Any hints about better way to debug it or log in some aprticular way
> would be appriciated.
>
> Thanks alot in advance...
> Pawel
>
>
>
>
>
>