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

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

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

State: closed
Merged: Yes


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
**Original Pull Request:** https://github.com/microsoft/terminal/pull/2184 **State:** closed **Merged:** Yes --- ## 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
claunia added the pull-request label 2026-01-31 09:05:43 +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#24847