[PR #2511] Selection Code Cleanup and Double Click Delimiter Runs #24976

Open
opened 2026-01-31 09:06:29 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


Summary of the Pull Request

Just some housekeeping work on our selection. Added a few more tests and refactored some of the functionality to improve code clarity.

Reenabled x86 tests. They work on my machine. I hope they work on CI?

Added support for double clicking delimiter runs.

Double Click Delimiter runs now operate as follows. Characters are separated into 3 classes:

  • class 0: spaces and control characters
  • class 1: delimiters imported from settings
  • class 2: all other characters
    If you double click a cell, the selection will expand until the class of the next cell differs from the preceding one.

This is slightly different than before in that the following example will only highlight the ">" char instead of the ">" and all the surrounding spaces:

C:\Terminal>
           ^
double click here

References

N/A

PR Checklist

Detailed Description of the Pull Request / Additional comments

Added some testing to ensure we don't crash on out-of-bounds selection anchors.
Consolidated the vertical offset for the anchors since they're always the same.
Broke up GetSelectionRects() into a more clear format with several helper methods.

Validation Steps Performed

All tests pass. I manually did some ALT+selections and regular selections w/ and w/out the scroll area and it still seems fine.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/2511 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Just some housekeeping work on our selection. Added a few more tests and refactored some of the functionality to improve code clarity. Reenabled x86 tests. They work on my machine. I hope they work on CI? Added support for double clicking delimiter runs. Double Click Delimiter runs now operate as follows. Characters are separated into 3 classes: - class 0: spaces and control characters - class 1: delimiters imported from settings - class 2: all other characters If you double click a cell, the selection will expand until the class of the next cell differs from the preceding one. This is slightly different than before in that the following example will only highlight the ">" char instead of the ">" and all the surrounding spaces: ``` C:\Terminal> ^ double click here ``` ## References N/A ## PR Checklist * [x] Closes #1327 * [x] Closes #2261 * [x] Closes #2206 * [x] CLA signed * [x] Tests added/passed * [x] ~Requires documentation to be updated~ * [x] I am a core contributor ## Detailed Description of the Pull Request / Additional comments Added some testing to ensure we don't crash on out-of-bounds selection anchors. Consolidated the vertical offset for the anchors since they're always the same. Broke up `GetSelectionRects()` into a more clear format with several helper methods. ## Validation Steps Performed All tests pass. I manually did some ALT+selections and regular selections w/ and w/out the scroll area and it still seems fine.
claunia added the pull-request label 2026-01-31 09:06:29 +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#24976