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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2511
Author: @carlos-zamora
Created: 8/22/2019
Status: Merged
Merged: 9/17/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/cazamor/misc-selection-tasks


📝 Commits (10+)

📊 Changes

4 files changed (+442 additions, -210 deletions)

View changed files

📝 src/cascadia/TerminalCore/Terminal.cpp (+1 -1)
📝 src/cascadia/TerminalCore/Terminal.hpp (+17 -9)
📝 src/cascadia/TerminalCore/TerminalSelection.cpp (+173 -103)
📝 src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp (+251 -97)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2511 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 8/22/2019 **Status:** ✅ Merged **Merged:** 9/17/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/cazamor/misc-selection-tasks` --- ### 📝 Commits (10+) - [`d93816e`](https://github.com/microsoft/terminal/commit/d93816e9a4b956bfb3be4eca6022bff6ae04a7b0) Test: out of bounds selection - [`85fb29c`](https://github.com/microsoft/terminal/commit/85fb29c274abbf2fc76b5f0ada0776855704f25e) Clean up Selection code: - [`4e6d723`](https://github.com/microsoft/terminal/commit/4e6d723f786a23e18234de1d598cffb2de445f7e) reenable x86 tests - [`e2e21aa`](https://github.com/microsoft/terminal/commit/e2e21aa707d213433a36ea59f180101cf013e163) Double Click selects delimiter runs - [`4dbfe59`](https://github.com/microsoft/terminal/commit/4dbfe592db27d99837aa666f600228a1523a1391) fix test - [`6fd44cf`](https://github.com/microsoft/terminal/commit/6fd44cff50021deec8d38e9637fdef3c5e536f45) Fix Delimiter Text Runs (#2552) - [`b277968`](https://github.com/microsoft/terminal/commit/b277968e879553c5e5514247f93be9e88037570d) PR Changes (need to add more tests though) - [`7aaa8b8`](https://github.com/microsoft/terminal/commit/7aaa8b8656d01f72e75c6bf1b8d2adfc4efdcaf6) PR changes - [`5a7e22c`](https://github.com/microsoft/terminal/commit/5a7e22c370175fc2bf6b0e2f74272d2771970485) Address PR comments - [`52f8028`](https://github.com/microsoft/terminal/commit/52f8028b1241199b39bf2cf30ed2b6275665af20) fixed failing test (whoops!) ### 📊 Changes **4 files changed** (+442 additions, -210 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+1 -1) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+17 -9) 📝 `src/cascadia/TerminalCore/TerminalSelection.cpp` (+173 -103) 📝 `src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp` (+251 -97) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:06:27 +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#24971