vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Terminal: Some keybindings involving the `Alt`-key are not sent correctly to shell

Open dietssa opened this issue 9 months ago • 1 comments

Type: Bug

Observed behavior I run a (fish-)shell in the terminal and notice that some keybindings involving the Alt key do not work as expected. I investigated using the command stdbuf -o0 showkey -a to observe the key press events in the terminal:

  • Alt + a works as expected.
  • Ctrl + Alt + a does not work: No key press registered, expected sequence is ^[^A
    • I checked in the "Keyboard Shortcut" settings that there is no keybinding Ctrl + Alt + a configured.
  • Alt + UpArrow does not work correctly: A key press is registered, but the sequence is the same one as for Ctrl + UpArrow: ^[[1;5A instead of expected ^[[1;3A.

Note: The expected sequences are what I see in a Windows Terminal session.

I tried to solve this using the non-default settings in settings.json:

    "terminal.integrated.sendKeybindingsToShell": true,
    "terminal.integrated.allowChords": false,

Without these settings, Alt + UpArrow does not show up as key press at all. The observations above are with these settings.

Desired behavior Keyboard shortcuts involving the Alt key should be correctly forwarded to the shell running in the terminal.

VS Code version: Code 1.98.0 (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z) OS version: Windows_NT x64 10.0.26100 Modes: Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 7 165H (22 x 3072)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.46GB (40.83GB free)
Process Argv --crash-reporter-id 06cb76c4-f9b1-4fb9-8b22-e2ccc7ffe56f
Screen Reader no
VM 0%
Item Value
Remote WSL: ubuntu
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) Ultra 7 165H (22 x 0)
Memory (System) 31.08GB (29.22GB free)
VM 0%
Extensions (1)
Extension Author (truncated) Version
remote-wsl ms- 0.88.5
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31192215
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
968h8231:31253945
jda6j935:31233686
4d2d8976:31247581
5b33h341:31253271

dietssa avatar Mar 07 '25 15:03 dietssa