Skip to content

Address code review points from #4 - #7

Merged
ragb merged 1 commit into
masterfrom
fix/review-points
Aug 24, 2026
Merged

ragb merged 1 commit into
masterfrom
fix/review-points

Conversation

@ragb

@ragb ragb commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Addresses three of the four points @Emil-18 raised in #4.

Window handle comparison. parent.simpleParent == desktop compared objects, so an add-on that adds overlay classes to the desktop object breaks the check and the walk never stops at the top-level window. Now compares windowHandle, with a None guard — simpleParent can be None, which the old comparison tolerated silently but attribute access would not.

POSITION_ALL. Five sites collapse makeTextInfo(POSITION_FIRST) + expand(UNIT_STORY) into makeTextInfo(POSITION_ALL), and the display-model path drops the 0x7fffffff line move that achieved the same thing.

Checked against NVDA source rather than assumed: textInfos/offsets.py sets start=0, end=_getStoryLength() for POSITION_ALL, and NVDAObjects/UIA returns UIATextPattern.documentRange, which is what ExpandToEnclosingUnit(Document) produces. Equivalent for both backends, which matters as three of these sites are the UIA TermControl.

Not done here: the suggestion to check whether the foreground object has display text and fall back to obtainUWPWindowText. That reshapes the branch dispatch rather than cleaning it up, and it interacts with the TermControl branch from #5. Left for a separate change, so #4 stays open.

Smoke tested as a dev build in a running NVDA across Windows Terminal, a Win32 window, and a UWP window.

Compare window handles rather than objects when deciding whether the walk
has reached the top-level window: an add-on that puts overlay classes on the
desktop object makes the identity comparison fail. Guard against a missing
parent, which the old comparison tolerated silently.

Replace POSITION_FIRST plus expand(UNIT_STORY) with POSITION_ALL at every
capture site, and drop the 0x7fffffff line move that did the same thing for
the display-model path. Equivalent for both the offsets and UIA backends.

Reported by @Emil-18 in #4.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ragb
ragb merged commit 2161c81 into master Aug 24, 2026
2 checks passed
@ragb
ragb deleted the fix/review-points branch August 24, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant