No longer allow moving to offset past end for NVDAObjectTextInfo#19531
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #18912 where NVDA incorrectly reports "blank" at the end of list items when using text review navigation by word. The root cause was that after PR #18744 fixed uniscribe issues, NVDAObjectTextInfo started allowing movement to offsets past the end of text. However, since NVDAObjectTextInfo has no insertion point (unlike editable text), this behavior was incorrect.
Changes:
- Added
allowMoveToUnitOffsetPastEndmethod to NVDAObjectTextInfo that returnsFalse, preventing movement past the end since there's no insertion point - Updated test class inheritance order to ensure CompoundTextLeafTextInfo's implementation takes precedence over NVDAObjectTextInfo's
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| source/NVDAObjects/init.py | Adds allowMoveToUnitOffsetPastEnd method returning False to prevent moving past end for text info without insertion point |
| tests/unit/test_compoundDocuments.py | Swaps inheritance order so CompoundTextLeafTextInfo's allowMoveToUnitOffsetPastEnd takes precedence over BasicTextInfo's inherited implementation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| class BasicCompoundTextLeafTextInfo(BasicTextInfo, compoundDocuments.CompoundTextLeafTextInfo): ... | ||
| class BasicCompoundTextLeafTextInfo(compoundDocuments.CompoundTextLeafTextInfo, BasicTextInfo): ... |
There was a problem hiding this comment.
This class does not call OffsetsTextInfo.init during initialization. (The class lacks an init method to ensure every base class init is called.)
|
|
||
|
|
||
| class BasicCompoundTextLeafTextInfo(BasicTextInfo, compoundDocuments.CompoundTextLeafTextInfo): ... | ||
| class BasicCompoundTextLeafTextInfo(compoundDocuments.CompoundTextLeafTextInfo, BasicTextInfo): ... |
There was a problem hiding this comment.
This class does not call TrackedObject.del during finalization. (The class lacks an del method to ensure every base class del is called.)
Link to issue number:
fixes #18912
Summary of the issue:
#18744 fixed up issues with uniscribe. Since that change, NVDAObjectTextInfo properly allows moving offset past end, however NVDAObjectTextInfo is not supposed to do so as it has no insertion point anyway.
Description of user facing changes:
NVDA no longer reports blank at the end of NVDA Objext text info text review, such as for list items.
Description of developer facing changes:
Since
allowMoveToUnitOffsetPastEndis now implemented on NVDAObjectTextInfo, I had to swap two classes in the inheritance hiërarchie for a unit tests class.Description of development approach:
Handle NVDAObjectTextInfo as a text info without insertion point, similar to virtual buffers. In other words, don't allow moving offset past end, as there's no point to do so.
Testing strategy:
Tested str from #18912
Known issues with pull request:
None known
Code Review Checklist: