[PR #13370] Introduce switchSelectionEndpoint action #29513

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

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

State: closed
Merged: Yes


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