[PR #9403] [MERGED] Fix selection logic with shift on multi-click #27574

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9403
Author: @Don-Vito
Created: 3/7/2021
Status: Merged
Merged: 3/8/2021
Merged by: @undefined

Base: mainHead: 9382-no-extend-sel-doubleclick


📝 Commits (4)

  • 7cca19d Fix selection not to extend on multi-click
  • 1aa147f Introduce selection reset on anchor / same position click
  • a11c9c2 Remove clean selection on anchor as mintty lives without it
  • 8d9d713 Remove extra space

📊 Changes

2 files changed (+43 additions, -21 deletions)

View changed files

📝 src/cascadia/TerminalControl/TermControl.cpp (+42 -21)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)

📄 Description

PR Checklist

Detailed Description of the Pull Request / Additional comments

The selection with shift is quite broken in 1.6.

It started with #8611 that introduces cell selection on shift+click.
This change resulted in the following defect:
shift+double-click, shift+triple-click select only parts of the word.
The reason for this is that the first shift+click establishes the selection,
while the consequent clicks simply extend it to the relevant boundary
(aka word / line boundary)

However, the logic was broken even before #8611.
For instance, shift+triple-click had exactly the same handicap:
shift+double-click was establishing the selection and the
third click was simply extending it to the line boundary.

This PR addresses the both defects in the following manner:
upon multi-click that starts new selection we establish
a new selection on every consequent click using appropriate mode
(cell/word/line) rather than trying to extend one.
For this purpose we remember the position that started the selection.


🔄 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/9403 **Author:** [@Don-Vito](https://github.com/Don-Vito) **Created:** 3/7/2021 **Status:** ✅ Merged **Merged:** 3/8/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `9382-no-extend-sel-doubleclick` --- ### 📝 Commits (4) - [`7cca19d`](https://github.com/microsoft/terminal/commit/7cca19d13f77187bce836b510376b52f6ceb19eb) Fix selection not to extend on multi-click - [`1aa147f`](https://github.com/microsoft/terminal/commit/1aa147f181f2c3b20749bbbbe3e6f9edb3925d31) Introduce selection reset on anchor / same position click - [`a11c9c2`](https://github.com/microsoft/terminal/commit/a11c9c258381475070030ebb45ceaef323854fba) Remove clean selection on anchor as mintty lives without it - [`8d9d713`](https://github.com/microsoft/terminal/commit/8d9d71392bebc1edeb2ac23348f19a8a90085c75) Remove extra space ### 📊 Changes **2 files changed** (+43 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+42 -21) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) </details> ### 📄 Description ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/issues/9382 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already. ## Detailed Description of the Pull Request / Additional comments The selection with shift is quite broken in 1.6. It started with #8611 that introduces cell selection on `shift+click`. This change resulted in the following defect: `shift+double-click`, `shift+triple-click` select only parts of the word. The reason for this is that the first `shift+click` establishes the selection, while the consequent clicks simply extend it to the relevant boundary (aka word / line boundary) However, the logic was broken even before #8611. For instance, `shift+triple-click` had exactly the same handicap: `shift+double-click` was establishing the selection and the third click was simply extending it to the line boundary. This PR addresses the both defects in the following manner: upon multi-click that starts new selection we establish a new selection on every consequent click using appropriate mode (cell/word/line) rather than trying to extend one. For this purpose we remember the position that started the selection. --- <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:22:46 +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#27574