mltony / nvda-sentence-nav

SentenceNav is an NVDA add-on that allows you to read text by sentences, as opposed to by paragraphs or words.
GNU General Public License v2.0
13 stars 8 forks source link

Fix for that it's not reading the sentences at the very end. #31

Closed mo29cg closed 1 year ago

mo29cg commented 1 year ago

This is a fix for https://github.com/mltony/nvda-sentence-nav/issues/30.

The problem was that, when it calls setEndPoint in line 368,

start.setEndPoint(end, "endToEnd")

if end was the very end of the contents, it failed to create textInfos correctly, so the text inside the textInfos is empty.

And speech.speakTextInfo also fail to speak the textInfo.

This PR is fixing it by setting the end point in a different way. You can try the difference in here. https://mo29cg.github.io/

Thanks for reading.

mltony commented 1 year ago

You are relying on offsets, I am worried that this is not going to work in non-offset-based textInfos, like in Thunderbird. _getUnitOffsets is only defined for offsets-based textInfos. Can you try something like: end.setEndPoint(start, "startToStart") Or maybe: start.move(textInfos.UNIT_CHARACTER,endOffset-startOffset, endpoint='end' )

On 5/14/2023 12:32 AM, suzukix wrote:

This is a fix for #30 https://github.com/mltony/nvda-sentence-nav/issues/30.

The problem was that, when it calls setEndPoint in line 368,

start.setEndPoint(end, "endToEnd")

if end was the very end of the contents, it failed to create textInfos correctly, so the text inside the textInfos is empty.

And speech.speakTextInfo also fail to speak the textInfo.

This PR is fixing it by setting the end point in a different way. You can try the difference in here. https://mo29cg.github.io/

Thanks for reading.


    You can view, comment on, or merge this pull request online at:

https://github.com/mltony/nvda-sentence-nav/pull/31

    Commit Summary

(1 file https://github.com/mltony/nvda-sentence-nav/pull/31/files)

— Reply to this email directly, view it on GitHub https://github.com/mltony/nvda-sentence-nav/pull/31, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJRDHD3SCCVBH2DOJB4VL3XGCDBBANCNFSM6AAAAAAYA7T32M. You are receiving this because you are subscribed to this thread.Message ID: @.***>

mo29cg commented 1 year ago

As you said, I confirmed there was an error trying to go to the last sentence in thundirbird. So, I changed it to move instead. It worked for both browsers and thunderbird.

end.setEndPoint(start, "startToStart") This didn't work by the way.

mltony commented 1 year ago

Thanks for fixing this!