Skip to content

Remove alt -> ctrl+arrow hack in favor of embedder-specific solutions#5346

Merged
Tyriar merged 2 commits intomasterfrom
copilot/fix-4538-2
May 31, 2025
Merged

Remove alt -> ctrl+arrow hack in favor of embedder-specific solutions#5346
Tyriar merged 2 commits intomasterfrom
copilot/fix-4538-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2025

This PR removes the HACK code that was converting Alt + arrow key combinations to behave like Ctrl + arrow keys for word movement functionality. This change moves the responsibility for this behavior from the terminal library to the embedders (like VS Code) where it can be implemented through application-specific keybindings.

Changes Made

Keyboard.ts

  • Removed 4 HACK blocks (24 lines total) that were intercepting Alt + arrow keys and converting them to Ctrl + arrow key escape sequences
  • Alt + arrow keys now return their standard VT100 escape sequences:
    • Alt+left: \x1b[1;3D
    • Alt+right: \x1b[1;3C
    • Alt+up: \x1b[1;3A
    • Alt+down: \x1b[1;3B

Keyboard.test.ts

  • Updated all tests to expect the correct Alt + arrow escape sequences instead of the previous Ctrl + arrow sequences
  • Updated tests for both macOS and non-macOS platforms to be consistent with the new behavior

Benefits

  1. Cleaner architecture: Removes application-specific behavior from the terminal library
  2. Better separation of concerns: Embedders can now implement word movement through their own keybinding systems
  3. More predictable behavior: Alt + arrow keys now consistently return standard VT100 sequences
  4. Easier customization: Applications like VS Code can easily disable or modify this behavior through their keybinding configuration

Testing

  • All 2241 unit tests pass
  • Build completes successfully
  • No other source files depend on the removed functionality

Migration Path for Embedders

Embedders like VS Code will need to add keybindings that map Alt + arrow keys to Ctrl + arrow keys if they want to preserve the word movement behavior. This can be done through their existing keybinding systems, making it easier to customize or disable as needed.

Fixes #4538.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Remove alt -> ctrl+arrow hack in favor of embedder-specific solutions Remove alt -> ctrl+arrow hack in favor of embedder-specific solutions May 29, 2025
Copilot AI requested a review from Tyriar May 29, 2025 13:23
Copilot finished work on behalf of Tyriar May 29, 2025 13:23
@Tyriar Tyriar marked this pull request as ready for review May 31, 2025 13:54
@Tyriar Tyriar merged commit 4b6316e into master May 31, 2025
23 checks passed
@Tyriar Tyriar deleted the copilot/fix-4538-2 branch May 31, 2025 13:59
@Tyriar Tyriar added this to the 6.0.0 milestone Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove alt -> ctrl+arrow hack in favor of embedder-specific solutions

2 participants