[PR #2184] [MERGED] Chunk Selection Expansion for Double/Triple Click Selection #24842

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2184
Author: @carlos-zamora
Created: 7/31/2019
Status: Merged
Merged: 8/15/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/cazamor/chunk-selection


📝 Commits (10+)

  • 35ca5d6 Chunk selection
  • c7ac572 bugfix: double-click delimiter
  • 3035815 I hate the formatter, but it makes my code look better
  • fa0198f Double/Triple Click testing
  • ceae2b8 MOAR CODE FORMATTING
  • 35c06f9 PR change - enum nit
  • 08c6e24 Merge branch 'master' into dev/cazamor/chunk-selection
  • 8d9e9c3 DHowett-MSFT's suggestions
  • b51d008 code format AGAIN
  • 8dd436b fix x86 failure

📊 Changes

6 files changed (+320 additions, -85 deletions)

View changed files

📝 src/cascadia/TerminalCore/Terminal.hpp (+11 -3)
📝 src/cascadia/TerminalCore/TerminalSelection.cpp (+49 -29)
src/cascadia/UnitTests_TerminalCore/MockTermSettings.h (+59 -0)
📝 src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp (+1 -49)
📝 src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp (+199 -4)
📝 src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj (+1 -0)

📄 Description

Summary of the Pull Request

Double/Triple click create a selection expanding beyond one cell. This PR makes it so that when you're dragging your mouse to expand the selection, you expand to the next delimiter defined by double/triple click.

So, double click expands by doubleClickDelimiter ranges. Triple click expands by line.

When you double/triple click, a word/line is selected. When you drag, that word/line will remain selected after the expansion occurs.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Rather than resizing the selection when the mouse event occurs, I figured I'd do what I did with wide glyph selection: expand at render time.

We needed an enum multiClickSelectionMode to keep track of which expansion mode we're in.

Minor modifications to _ExpandDoubleClickSelection*(COORD) had to be made so that we can re-use them.

Actual expansion occurs in _GetSelectionRects()

Validation Steps Performed

  • generic double click test
    • dir or ls
    • double click a word
    • drag up
    • Works! ✔
  • double click on delimiter test
    • dir or ls
    • double click a word delimiter (i.e.: space between words)
    • drag up
    • Works! ✔
  • generic triple click test
    • dir or ls
    • triple click a line
    • drag up
    • Works! ✔
  • ALT + double click test
    • dir or ls
    • hold ALT
    • double click a word
    • drag up
    • Works! ✔

repeat above tests in following scenarios:

  • when at top of scrollback
  • drag down instead of up

🔄 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/2184 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 7/31/2019 **Status:** ✅ Merged **Merged:** 8/15/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/cazamor/chunk-selection` --- ### 📝 Commits (10+) - [`35ca5d6`](https://github.com/microsoft/terminal/commit/35ca5d6fda1e667913422136b580591e15b057b9) Chunk selection - [`c7ac572`](https://github.com/microsoft/terminal/commit/c7ac572f19dd64535c25d17e8793d2cda297d835) bugfix: double-click delimiter - [`3035815`](https://github.com/microsoft/terminal/commit/3035815ac47824e08f0c1acf66ff0d5b74de1676) I hate the formatter, but it makes my code look better - [`fa0198f`](https://github.com/microsoft/terminal/commit/fa0198f71cc6f4ecdff099baa3fe4a047d9a8eea) Double/Triple Click testing - [`ceae2b8`](https://github.com/microsoft/terminal/commit/ceae2b8113db99d3ff960bf0509f87e4d320c2fd) MOAR CODE FORMATTING - [`35c06f9`](https://github.com/microsoft/terminal/commit/35c06f9f0aafe38779ccc1d3a936aae024284e10) PR change - enum nit - [`08c6e24`](https://github.com/microsoft/terminal/commit/08c6e24bf28ddb721393cd23675f77572d6b6224) Merge branch 'master' into dev/cazamor/chunk-selection - [`8d9e9c3`](https://github.com/microsoft/terminal/commit/8d9e9c327901211bd568db5ffa73f47b1b2da807) DHowett-MSFT's suggestions - [`b51d008`](https://github.com/microsoft/terminal/commit/b51d00876a87ee15ba580c7b9cfc0709e6a75a37) code format AGAIN - [`8dd436b`](https://github.com/microsoft/terminal/commit/8dd436b33c9acba21202e29f685860da896f4a0d) fix x86 failure ### 📊 Changes **6 files changed** (+320 additions, -85 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+11 -3) 📝 `src/cascadia/TerminalCore/TerminalSelection.cpp` (+49 -29) ➕ `src/cascadia/UnitTests_TerminalCore/MockTermSettings.h` (+59 -0) 📝 `src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp` (+1 -49) 📝 `src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp` (+199 -4) 📝 `src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request Double/Triple click create a selection expanding beyond one cell. This PR makes it so that when you're dragging your mouse to expand the selection, you expand to the next delimiter defined by double/triple click. So, double click expands by doubleClickDelimiter ranges. Triple click expands by line. When you double/triple click, a word/line is selected. When you drag, that word/line will remain selected after the expansion occurs. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1933 * [x] CLA signed. * [ ] Tests ~added/passed~ not necessary * [x] Requires documentation to be updated * [x] I am a core contributor ## Detailed Description of the Pull Request / Additional comments Rather than resizing the selection when the mouse event occurs, I figured I'd do what I did with wide glyph selection: expand at render time. We needed an enum `multiClickSelectionMode` to keep track of which expansion mode we're in. Minor modifications to `_ExpandDoubleClickSelection*(COORD)` had to be made so that we can re-use them. Actual expansion occurs in `_GetSelectionRects()` ## Validation Steps Performed - generic double click test - `dir` or `ls` - double click a word - drag up - Works! ✔ - double click on delimiter test - `dir` or `ls` - double click a word delimiter (i.e.: space between words) - drag up - Works! ✔ - generic triple click test - `dir` or `ls` - triple click a line - drag up - Works! ✔ - ALT + double click test - `dir` or `ls` - hold ALT - double click a word - drag up - Works! ✔ repeat above tests in following scenarios: - when at top of scrollback - drag down instead of up --- <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:05:40 +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#24842