[PR #13370] [MERGED] Introduce switchSelectionEndpoint action #29508

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13370
Author: @carlos-zamora
Created: 6/23/2022
Status: Merged
Merged: 7/1/2022
Merged by: @undefined

Base: mainHead: dev/cazamor/kbd-sln/switchSelectionEndpoint


📝 Commits (5)

  • 81a7e20 Introduce switchSelectionEndpoint action
  • fda1cc7 fix corner case with cursor movement
  • 60b043d I can never spell targeted -.-
  • 84b65ff schema
  • 5e49772 shouldMoveCursor --> shouldMoveBothEndpoints; _anchorSelectionEndpoint --> anchorInactiveSelectionEndpoint

📊 Changes

15 files changed (+77 additions, -3 deletions)

View changed files

📝 doc/cascadia/profiles.schema.json (+1 -0)
📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+10 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+10 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+1 -0)
📝 src/cascadia/TerminalControl/ControlCore.idl (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+5 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+1 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+1 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+2 -0)
📝 src/cascadia/TerminalCore/TerminalSelection.cpp (+36 -2)
📝 src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp (+2 -0)
📝 src/cascadia/TerminalSettingsModel/AllShortcutActions.h (+2 -1)
📝 src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw (+3 -0)
📝 src/cascadia/TerminalSettingsModel/defaults.json (+1 -0)

📄 Description

Summary of the Pull Request

Introduces the switchSelectionEndpoint action which switches whichever selection endpoint is targeted when a selection is present. For example, if you are targeting "start", switchSelectionEndpoint makes it so that now you are targeting "end". This also updates the selection markers appropriately.

References

Spec - #5804
#13358
Closes #3663

Detailed Description of the Pull Request / Additional comments

Most of the code is just standard code of adding a new action. Other than that, we have...

  • if there is no selection, the action fails and the keybinding is passed through (similar to copy())
  • when we update the selection endpoint, we need to also update the "pivot". This ensures that future calls of UpdateSelection() respect this swap.
  • [Corner Case] if the cursor is being moved, we make it so that you basically "anchored" an endpoint and you don't have to hold shift anymore.

🔄 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/13370 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 6/23/2022 **Status:** ✅ Merged **Merged:** 7/1/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/cazamor/kbd-sln/switchSelectionEndpoint` --- ### 📝 Commits (5) - [`81a7e20`](https://github.com/microsoft/terminal/commit/81a7e207087f57b32d2b1a932ee92740630e2568) Introduce `switchSelectionEndpoint` action - [`fda1cc7`](https://github.com/microsoft/terminal/commit/fda1cc7c53329b3a337e91ce73cfb4a4b8c5e2e9) fix corner case with cursor movement - [`60b043d`](https://github.com/microsoft/terminal/commit/60b043d37b9a6680c129a0d8d3102672d09ddf76) I can never spell targeted -.- - [`84b65ff`](https://github.com/microsoft/terminal/commit/84b65ff0ace7ec88106f9566ee33d007d4aad06b) schema - [`5e49772`](https://github.com/microsoft/terminal/commit/5e49772cab720fa12dcb850ab2e426dbf0fbe24e) shouldMoveCursor --> shouldMoveBothEndpoints; _anchorSelectionEndpoint --> anchorInactiveSelectionEndpoint ### 📊 Changes **15 files changed** (+77 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `doc/cascadia/profiles.schema.json` (+1 -0) 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+1 -0) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+5 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+1 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+1 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+2 -0) 📝 `src/cascadia/TerminalCore/TerminalSelection.cpp` (+36 -2) 📝 `src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp` (+2 -0) 📝 `src/cascadia/TerminalSettingsModel/AllShortcutActions.h` (+2 -1) 📝 `src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw` (+3 -0) 📝 `src/cascadia/TerminalSettingsModel/defaults.json` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request Introduces the `switchSelectionEndpoint` action which switches whichever selection endpoint is targeted when a selection is present. For example, if you are targeting "start", `switchSelectionEndpoint` makes it so that now you are targeting "end". This also updates the selection markers appropriately. ## References Spec - #5804 #13358 Closes #3663 ## Detailed Description of the Pull Request / Additional comments Most of the code is just standard code of adding a new action. Other than that, we have... - if there is no selection, the action fails and the keybinding is passed through (similar to `copy()`) - when we update the selection endpoint, we need to also update the "pivot". This ensures that future calls of `UpdateSelection()` respect this swap. - [Corner Case] if the cursor is being moved, we make it so that you basically "anchored" an endpoint and you don't have to hold shift anymore. --- <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:35:20 +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#29508