[PR #10824] Implement Keyboard Selection #28252

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

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

State: closed
Merged: Yes


Summary of the Pull Request

Implements the following keyboard selection non-configurable key bindings:

  • shift+arrow --> move endpoint by character
  • ctrl+shift+left/right --> move endpoint by word
  • shift+home/end --> move to beginning/end of line
  • ctrl+shift+home/end --> move to beginning/end of buffer

This was purposefully done in the ControlCore layer to make keyboard selection an innate part of how the terminal functions (aka a shared component across terminal consumers).

References

#715 - Keyboard Selection
#2840 - Spec

Detailed Description of the Pull Request / Additional comments

The most relevant section is TerminalSelection.cpp, where we define how each movement operates. It's basically a giant embedded switch-case statement. We leverage a lot of the work done in a11y to perform the movements.

Validation Steps Performed

  • General cases:
    • test all of the key bindings added
  • Corner cases:
    • char: wide glyph support
    • word: move towards, away, and across the selection pivot
    • automatically scroll viewport
    • ESC (and other key combos) are still clearing the selection properly
**Original Pull Request:** https://github.com/microsoft/terminal/pull/10824 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Implements the following keyboard selection non-configurable key bindings: - shift+arrow --> move endpoint by character - ctrl+shift+left/right --> move endpoint by word - shift+home/end --> move to beginning/end of line - ctrl+shift+home/end --> move to beginning/end of buffer This was purposefully done in the ControlCore layer to make keyboard selection an innate part of how the terminal functions (aka a shared component across terminal consumers). ## References #715 - Keyboard Selection #2840 - Spec ## Detailed Description of the Pull Request / Additional comments The most relevant section is `TerminalSelection.cpp`, where we define how each movement operates. It's basically a giant embedded switch-case statement. We leverage a lot of the work done in a11y to perform the movements. ## Validation Steps Performed - General cases: - test all of the key bindings added - Corner cases: - `char`: wide glyph support - `word`: move towards, away, and across the selection pivot - automatically scroll viewport - ESC (and other key combos) are still clearing the selection properly
claunia added the pull-request label 2026-01-31 09:27:18 +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#28252