UIA Providers misrepresent box selections #6349

Closed
opened 2026-01-31 00:36:23 +00:00 by claunia · 3 comments
Owner

Originally created by @carlos-zamora on GitHub (Feb 8, 2020).

Summary

Our TermControlUiaProvider (aka ScreenInfoUiaProvider) assumes that a retrieved selection is always a line selection.

Technical Details

ScreenInfoUiaProviderBase::GetSelection() returns a UiaTextRange for the endpoints of the selection (after a brief inclusive/exclusive conversion). We need two modifications here:

  1. ScreenInfoUiaProviderBase should check if the selection is a box selection or a line selection. And should create a different branch for each of those options.
  2. UiaTextRangeBase needs...
  • a constructor for a box selection UTR
  • a flag to know if it is in this style
  • a new bounding rect for a UTR of this style
  • a modified way to retrieve text for this
  • (?) modify Select to make a box selection? not needed. How selections are made is already abstracted to the selection code, not UIA providers
Originally created by @carlos-zamora on GitHub (Feb 8, 2020). # Summary Our TermControlUiaProvider (aka ScreenInfoUiaProvider) assumes that a retrieved selection is always a line selection. # Technical Details `ScreenInfoUiaProviderBase::GetSelection()` returns a `UiaTextRange` for the endpoints of the selection (after a brief inclusive/exclusive conversion). We need two modifications here: 1. `ScreenInfoUiaProviderBase` should check if the selection is a box selection or a line selection. And should create a different branch for each of those options. 2. `UiaTextRangeBase` needs... - [x] a constructor for a box selection UTR - [x] a flag to know if it is in this style - [x] a new bounding rect for a UTR of this style - [x] a modified way to retrieve text for this - [x] ~(?) modify `Select` to make a box selection?~ not needed. How selections are made is already abstracted to the selection code, not UIA providers
Author
Owner

@carlos-zamora commented on GitHub (Feb 10, 2020):

Closed the PR attempting to fix this. Ran into the following problem:
Closing this PR. This is the incorrect approach because of the following scenario:

TextBuffer:

     axxxx
   😀xxx😀
     xxxxx
   😀xxx😀
     xxxxb

Selecting from a to b in box selection should result in all of the x being selected, but the selection expanding to encompass the wide glyphs. The implementation in this PR does not account for the wide glyphs.

Proposed Implementation

Create a SelectionTextRange class that implements the UiaTextRange class.
Make this heavily rely on GetSelectionRects to properly represent the selection.
GetSelection from ScreenInfoUiaProviderBase should just create this type of text range and abstract all of the difficult bits away. The SelectionTextRange constructor would just take the output from GetSelectionRects.

@carlos-zamora commented on GitHub (Feb 10, 2020): Closed the PR attempting to fix this. Ran into the following problem: Closing this PR. This is the incorrect approach because of the following scenario: TextBuffer: ``` axxxx 😀xxx😀 xxxxx 😀xxx😀 xxxxb ``` Selecting from `a` to `b` in box selection should result in all of the `x` being selected, but the selection expanding to encompass the wide glyphs. The implementation in this PR does not account for the wide glyphs. # Proposed Implementation Create a `SelectionTextRange` class that implements the `UiaTextRange` class. Make this heavily rely on `GetSelectionRects` to properly represent the selection. `GetSelection` from `ScreenInfoUiaProviderBase` should just create this type of text range and abstract all of the difficult bits away. The `SelectionTextRange` constructor would just take the output from `GetSelectionRects`.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 10, 2020):

This has always been an issue and is task-level work; recategorized as a task.

@DHowett-MSFT commented on GitHub (Feb 10, 2020): This has always been an issue and is task-level work; recategorized as a task.
Author
Owner

@ghost commented on GitHub (Apr 22, 2020):

:tada:This issue was addressed in #4991, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.🎉

Handy links:

@ghost commented on GitHub (Apr 22, 2020): :tada:This issue was addressed in #4991, which has now been successfully released as `Windows Terminal Preview v0.11.1121.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.11.1121.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6349