[PR #10865] [MERGED] Add selection marker overlays for keyboard selection #28264

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10865
Author: @carlos-zamora
Created: 8/3/2021
Status: Merged
Merged: 6/20/2022
Merged by: @DHowett

Base: mainHead: dev/cazamor/ks/copy-mode


📝 Commits (10+)

  • 76e77de Add selection marker overlays for keyboard selection
  • 214d3af simplify logic a bit
  • f9baadc add markers as paths; fix selectAll/toggleMarkMode
  • aa2ff6b MovingStart-->MovingEnd
  • 23dc59f Merge branch 'main' into dev/cazamor/ks/copy-mode
  • b6a1154 address zadji's feedback
  • 365cfcf Merge branch 'main' into dev/cazamor/ks/copy-mode
  • 659230a address Dustin's feedback
  • 2007e18 flip markers at side boundaries
  • 4623371 fix unfocused appearance bug

📊 Changes

12 files changed (+285 additions, -31 deletions)

View changed files

📝 src/cascadia/TerminalControl/ControlCore.cpp (+49 -7)
📝 src/cascadia/TerminalControl/ControlCore.h (+3 -0)
📝 src/cascadia/TerminalControl/ControlCore.idl (+12 -0)
📝 src/cascadia/TerminalControl/EventArgs.cpp (+1 -0)
📝 src/cascadia/TerminalControl/EventArgs.h (+12 -0)
📝 src/cascadia/TerminalControl/EventArgs.idl (+5 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+123 -8)
📝 src/cascadia/TerminalControl/TermControl.h (+3 -0)
📝 src/cascadia/TerminalControl/TermControl.xaml (+10 -0)
📝 src/cascadia/TerminalControl/pch.h (+1 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+4 -0)
📝 src/cascadia/TerminalCore/TerminalSelection.cpp (+62 -15)

📄 Description

Summary of the Pull Request

This introduces a selection marker overlay that tells the user which endpoint is currently being moved by the keyboard. The selection markers are respect font size changes and cursor color.

References

#715 - Keyboard Selection
#2840 - Keyboard Selection Spec
#5804 - Mark Mode Spec

Detailed Description of the Pull Request / Additional comments

  • TermControl layer:
    • Use a canvas (similar to the one used for hyperlinks) to be able to draw the selection markers.
    • If we are notified that the selection changed, update the selection markers appropriately.
    • UpdateSelectionMarkersEventArgs lets us distinguish between mouse and keyboard selections. ClearMarkers is set to true in the following cases...
      1. Mouse selection, via SetEndSelectionPoint
      2. LeftClickOnTerminal, pretty self-explanatory
      3. a selection created from searching for text
  • ControlCore layer:
    • Responsible for notifying TermControl to update the selection markers when a selection has changed.
    • Transfers info (the selection endpoint positions and which endpoint we're moving) from the terminal core to the term control.
  • TerminalCore layer:
    • Provides the viewport position of the selection endpoints.

Validation Steps Performed

  • mouse selection (w/ and w/out shift) --> no markers
  • keyboard selection --> markers
  • markers update appropriately when we pivot the selection
  • markers scroll when you hit a boundary
  • markers take the color of the cursor color setting
  • markers are resized when the font size changes

🔄 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/10865 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 8/3/2021 **Status:** ✅ Merged **Merged:** 6/20/2022 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/cazamor/ks/copy-mode` --- ### 📝 Commits (10+) - [`76e77de`](https://github.com/microsoft/terminal/commit/76e77deeccd93401999bd40f09bed91548f026ce) Add selection marker overlays for keyboard selection - [`214d3af`](https://github.com/microsoft/terminal/commit/214d3af27ff86cf9b4c3210a40e2cfc40cdecc94) simplify logic a bit - [`f9baadc`](https://github.com/microsoft/terminal/commit/f9baadc5514f18dccbfe32889ad06941020e90da) add markers as paths; fix selectAll/toggleMarkMode - [`aa2ff6b`](https://github.com/microsoft/terminal/commit/aa2ff6b658f5f84d87d59b4dfce26b1412a71093) MovingStart-->MovingEnd - [`23dc59f`](https://github.com/microsoft/terminal/commit/23dc59f162aa2974577cc894d3b9b2b025afec2a) Merge branch 'main' into dev/cazamor/ks/copy-mode - [`b6a1154`](https://github.com/microsoft/terminal/commit/b6a11540fd67fbe87d8869b3ee7db997d674fc21) address zadji's feedback - [`365cfcf`](https://github.com/microsoft/terminal/commit/365cfcfe1ee2693a37c2c27001199fcae28f12fe) Merge branch 'main' into dev/cazamor/ks/copy-mode - [`659230a`](https://github.com/microsoft/terminal/commit/659230a34a2707ecd34c0be1950f9776acc20356) address Dustin's feedback - [`2007e18`](https://github.com/microsoft/terminal/commit/2007e180fdea24d220758258a095b18e3ed07c19) flip markers at side boundaries - [`4623371`](https://github.com/microsoft/terminal/commit/4623371334591a89826628cd41212ba3a91906c2) fix unfocused appearance bug ### 📊 Changes **12 files changed** (+285 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+49 -7) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+3 -0) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+12 -0) 📝 `src/cascadia/TerminalControl/EventArgs.cpp` (+1 -0) 📝 `src/cascadia/TerminalControl/EventArgs.h` (+12 -0) 📝 `src/cascadia/TerminalControl/EventArgs.idl` (+5 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+123 -8) 📝 `src/cascadia/TerminalControl/TermControl.h` (+3 -0) 📝 `src/cascadia/TerminalControl/TermControl.xaml` (+10 -0) 📝 `src/cascadia/TerminalControl/pch.h` (+1 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+4 -0) 📝 `src/cascadia/TerminalCore/TerminalSelection.cpp` (+62 -15) </details> ### 📄 Description ## Summary of the Pull Request This introduces a selection marker overlay that tells the user which endpoint is currently being moved by the keyboard. The selection markers are respect font size changes and `cursor` color. ## References #715 - Keyboard Selection #2840 - Keyboard Selection Spec #5804 - Mark Mode Spec ## Detailed Description of the Pull Request / Additional comments - `TermControl` layer: - Use a canvas (similar to the one used for hyperlinks) to be able to draw the selection markers. - If we are notified that the selection changed, update the selection markers appropriately. - `UpdateSelectionMarkersEventArgs` lets us distinguish between mouse and keyboard selections. `ClearMarkers` is set to true in the following cases... 1. Mouse selection, via SetEndSelectionPoint 2. `LeftClickOnTerminal`, pretty self-explanatory 3. a selection created from searching for text - `ControlCore` layer: - Responsible for notifying `TermControl` to update the selection markers when a selection has changed. - Transfers info (the selection endpoint positions and which endpoint we're moving) from the terminal core to the term control. - `TerminalCore` layer: - Provides the viewport position of the selection endpoints. ## Validation Steps Performed - mouse selection (w/ and w/out shift) --> no markers - keyboard selection --> markers - markers update appropriately when we pivot the selection - markers scroll when you hit a boundary - markers take the color of the cursor color setting - markers are resized when the font size changes --- <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:27:23 +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#28264