nvda
8742b3a6 - Fix OffsetTextInfo.collapse() and OffsetTextInfo.move() (#18348)

Commit
285 days ago
Fix OffsetTextInfo.collapse() and OffsetTextInfo.move() (#18348) Fixes #18320. This is my second attempt to fix it without breaking #17430. For the reference, the first attempt was #18338, which is abandoned, and which didn't fix the root cause, but just decoupled @nvdaes's commit from TextInfo API. This PR however fixes the root cause of #17430. Summary of the issue: Commit 70cd311 by @nvdaes introduced a bug in TextInfo API: `TextInfo.collapse()` now unnecessarily jumps to the next paragraph in Notepad++. This bug also made its way into 2025.1 release. I investigated the braille issue #17430 further and it boiled down to an issue with `OffsetTextInfo.move()` implementation: it turns out that unless it moves by character, it is unable to move to the very last position in the document. Fixing `OffsetTextInfo.move()` implementation. Description of user facing changes: None Description of developer facing changes: `OffsetTextInfo.collapse()` now works correctly in Notepad++. `OffsetTextInfo.move()` can now move to the very last position even when unit is set to line or paragraph. Description of development approach: 1. In `OffsetTextInfo.move()` modified the condition when `self.allowMoveToOffsetPastEnd` to increase `highLimit` regardless of current unit - previously this would only allow when unit is character. 2. Removed `ScintillaTextInfo.expand()` override. Testing strategy: 1. Tested with use case provided in #18320. 2. Tested that `OffsetTextInfo.move('line', 1)` can now successfully go to the very last line in Notepad++ even if the last line is empty. This should be the proper fix for #17430. Known issues with pull request: None
Author
Parents
Loading