[PR #4495] UIA: Fix GetVisibleRanges() and add Tracing #25791

Closed
opened 2026-01-31 09:11:48 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4495

State: closed
Merged: Yes


Summary of the Pull Request

Debugging our custom UIA providers has been a painful experience because outputting content to VS may result in UIA Clients getting impatient and giving up on extracting data.

Adding tracing allows us to debug these providers without getting in the way of reproducing a bug. This will help immensely with developing accessibility features on Windows Terminal and Console.

This pull request additionally contains payload from #4526:

  • Make GetVisibleRanges() return one range (and add tracing for it).
    ScreenInfoUiaProvider::GetVisibleRanges() used to return one range per line of visible text. The documentation for this function says that we should return one per contiguous span of text. Since all of the text in the TermControl will always be contiguous (at least by our standards), we should only ever be returning one range.

PR Checklist

Detailed Description of the Pull Request / Additional comments

UiaTracing is a singleton class that is in charge of registration for trace logging. TextRange is used to trace UiaTextRange, whereas TextProvider is used to trace ScreenInfoUiaProviderBase.

_getValue() is overloaded to transform complex objects and enums into a string for logging.

_getTextValue() had to be added to be able to trace the text a UiaTextRange included. This makes following UiaTextRanges much simpler.

Validation Steps Performed

Performed a few operations when under NVDA/Narrator and manually checked the results.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4495 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Debugging our custom UIA providers has been a painful experience because outputting content to VS may result in UIA Clients getting impatient and giving up on extracting data. Adding tracing allows us to debug these providers without getting in the way of reproducing a bug. This will help immensely with developing accessibility features on Windows Terminal and Console. This pull request additionally contains payload from #4526: * Make GetVisibleRanges() return one range (and add tracing for it). `ScreenInfoUiaProvider::GetVisibleRanges()` used to return one range per line of visible text. The documentation for this function says that we should return one per contiguous span of text. Since all of the text in the TermControl will always be contiguous (at least by our standards), we should only ever be returning one range. ## PR Checklist * [x] Closes #1914. Closes #4507. * [x] CLA signed ## Detailed Description of the Pull Request / Additional comments `UiaTracing` is a singleton class that is in charge of registration for trace logging. `TextRange` is used to trace `UiaTextRange`, whereas `TextProvider` is used to trace `ScreenInfoUiaProviderBase`. `_getValue()` is overloaded to transform complex objects and enums into a string for logging. `_getTextValue()` had to be added to be able to trace the text a UiaTextRange included. This makes following UiaTextRanges much simpler. ## Validation Steps Performed Performed a few operations when under NVDA/Narrator and manually checked the results.
claunia added the pull-request label 2026-01-31 09:11:48 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25791