[PR #7789] Add optimization to get a11y next word #26993

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

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

State: closed
Merged: Yes


This performs a minor refactor on TextBuffer::MoveToNextWord that
relies more heavily on TextBuffer::GetWordEnd. Now, the logic is
simplified and looks more like MoveToPreviousWord.

This refactor required me to move the lastCharPos optimization down to
GetWordEnd. So word expansion gets this optimization for free now.

WPR Traces

The percentages below represent the weight that a function call had. The
test scenario included moving by word on the CMD welcome message until
the last word was reached. Inspect.exe was used to limit any additional
calls that are generally performed by a screen reader.

function current branch
UIA:Move 34.55% 29.52%

There is an improvement of about 5% in a release build of ConHost.

NOTE: UIA::Move already calls Expand after a move operation is
performed. I'm using this data to represent a performance improvement
across both functions.

Contributes to #5243

**Original Pull Request:** https://github.com/microsoft/terminal/pull/7789 **State:** closed **Merged:** Yes --- This performs a minor refactor on `TextBuffer::MoveToNextWord` that relies more heavily on `TextBuffer::GetWordEnd`. Now, the logic is simplified and looks more like `MoveToPreviousWord`. This refactor required me to move the `lastCharPos` optimization down to `GetWordEnd`. So word expansion gets this optimization for free now. ### WPR Traces The percentages below represent the weight that a function call had. The test scenario included moving by word on the CMD welcome message until the last word was reached. Inspect.exe was used to limit any additional calls that are generally performed by a screen reader. | function | current | branch | | -- | -- | -- | | `UIA:Move` | 34.55% | 29.52% | There is an improvement of about 5% in a release build of ConHost. NOTE: `UIA::Move` already calls `Expand` after a move operation is performed. I'm using this data to represent a performance improvement across both functions. Contributes to #5243
claunia added the pull-request label 2026-01-31 09:19:22 +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#26993