Support for unbound Ctrl-Tab, Ctrl-Shift-Tab key combinations #12255

Closed
opened 2026-01-31 03:10:25 +00:00 by claunia · 11 comments
Owner

Originally created by @tmtom on GitHub (Jan 28, 2021).

Environment

Windows build number: Microsoft Windows [Version 10.0.19042.746]
Windows Terminal version (if applicable): 1.6.10272.0
ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

Steps to reproduce

Configure SSH session to a Linux system using Windows SSH client.
Unbind Ctrl-Tab combination so that it is passed through. I.e. add to settings to "actions": { "command": "unbound", "keys": "ctrl+tab" }

Open an SSH terminal to a Linux system as root and run "showkey -k" (or use terminal application which uses ctrl-tab key combination).

Expected behavior

When pressing ctrl-tab:
"showkey -k" shows: ^[[27;5;9~

or the given terminal application reacts as expected.

Actual behavior

"showkey -k" shows ^@

or the given terminal application does not react (wrong key press is apparently being passed).

I would like to be able to pass ctrl+tab (and eventually also ctrl+shift+tab) to the ssh window. For example kitty (https://sw.kovidgoyal.net/kitty/) supports this.

Originally created by @tmtom on GitHub (Jan 28, 2021). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19042.746] Windows Terminal version (if applicable): 1.6.10272.0 ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 ``` # Steps to reproduce Configure SSH session to a Linux system using Windows SSH client. Unbind Ctrl-Tab combination so that it is passed through. I.e. add to settings to "actions": { "command": "unbound", "keys": "ctrl+tab" } Open an SSH terminal to a Linux system as root and run "showkey -k" (or use terminal application which uses ctrl-tab key combination). # Expected behavior When pressing ctrl-tab: "showkey -k" shows: ^[[27;5;9~ or the given terminal application reacts as expected. # Actual behavior "showkey -k" shows ^@ or the given terminal application does not react (wrong key press is apparently being passed). I would like to be able to pass ctrl+tab (and eventually also ctrl+shift+tab) to the ssh window. For example kitty (https://sw.kovidgoyal.net/kitty/) supports this.
Author
Owner

@zadjii-msft commented on GitHub (Jan 28, 2021):

What does showkey -a output? I'm pretty certain it's supposed to be
image
for both Ctrl+Tab and Tab, which is what we're sending:
image

Does this repro with the ssh from WSL? Does updating ssh change anything?

@zadjii-msft commented on GitHub (Jan 28, 2021): What does `showkey -a` output? I'm pretty certain it's supposed to be ![image](https://user-images.githubusercontent.com/18356694/106206134-33a61880-6185-11eb-8b1d-3e45d8b8999d.png) for both <kbd>Ctrl+Tab</kbd> and <kbd>Tab</kbd>, which is what we're sending: ![image](https://user-images.githubusercontent.com/18356694/106206211-4ddff680-6185-11eb-835d-6c867da5d9dd.png) Does this repro with the `ssh` from WSL? Does updating `ssh` change anything?
Author
Owner

@tmtom commented on GitHub (Jan 28, 2021):

For ctrl-tab terminal shows:
^@ 0 0000 0x00

Kitty shows:
^[[27;5;9~ 27 0033 0x1b
91 0133 0x5b
50 0062 0x32
55 0067 0x37
59 0073 0x3b
53 0065 0x35
59 0073 0x3b
57 0071 0x39
126 0176 0x7e

My usecase is switching panes in tmux, i.e. having in .tmux.conf
bind-key -n "C-Tab" select-pane -t :.+
bind-key -n "C-S-Tab" select-pane -t :.-

@tmtom commented on GitHub (Jan 28, 2021): For ctrl-tab terminal shows: ^@ 0 0000 0x00 Kitty shows: ^[[27;5;9~ 27 0033 0x1b 91 0133 0x5b 50 0062 0x32 55 0067 0x37 59 0073 0x3b 53 0065 0x35 59 0073 0x3b 57 0071 0x39 126 0176 0x7e My usecase is switching panes in tmux, i.e. having in .tmux.conf bind-key -n "C-Tab" select-pane -t :.+ bind-key -n "C-S-Tab" select-pane -t :.-
Author
Owner

@DHowett commented on GitHub (Jan 28, 2021):

Kitty implements a custom modifier encoding protocol for this :| it is nonstandard

@DHowett commented on GitHub (Jan 28, 2021): Kitty implements a custom modifier encoding protocol for this :| it is nonstandard
Author
Owner

@tmtom commented on GitHub (Jan 28, 2021):

Would it be possible to add it as an option?
I see it has been also discussed how to add it to Putty - http://scnr.net/blog/index.php/archives/61

@tmtom commented on GitHub (Jan 28, 2021): Would it be possible to add it as an option? I see it has been also discussed how to add it to Putty - http://scnr.net/blog/index.php/archives/61
Author
Owner

@zadjii-msft commented on GitHub (Jan 28, 2021):

You could bind

{ "command": { "action": "sendInput", "input": "\u001b[27;5;9~" }, "keys":"ctrl+tab" },

instead, which should cause Ctrl+Tab to send ^[[27;5;9~. (I might have the escaping for an ESC in json wrong, but the idea stands).

I'd rather not implement support for a non-standard input encoding...

@zadjii-msft commented on GitHub (Jan 28, 2021): You could bind ```jsonc { "command": { "action": "sendInput", "input": "\u001b[27;5;9~" }, "keys":"ctrl+tab" }, ``` instead, which should cause <kbd>Ctrl+Tab</kbd> to send `^[[27;5;9~`. (I might have the escaping for an ESC in json wrong, but the idea stands). I'd rather _not_ implement support for a non-standard input encoding...
Author
Owner

@tmtom commented on GitHub (Jan 29, 2021):

Thanks for the hint. That would be perfect.
This way I am able to pass simple ANSI escape codes but so far was not able to pass the "double escape" sequence.
For example:
{ "command": { "action": "sendInput", "input": "\u001b[\u0032\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" }
produces:
^[[2;5~ 27 0033 0x1b
91 0133 0x5b
50 0062 0x32
59 0073 0x3b
53 0065 0x35
126 0176 0x7e

But this one:
{ "command": { "action": "sendInput", "input": "\u001b[\u0032\u0037\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" }

does not send anything.

I may need to learn how the input param is being processed.

@tmtom commented on GitHub (Jan 29, 2021): Thanks for the hint. That would be perfect. This way I am able to pass simple ANSI escape codes but so far was not able to pass the "double escape" sequence. For example: { "command": { "action": "sendInput", "input": "\u001b[\u0032\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" } produces: ^[[2;5~ 27 0033 0x1b 91 0133 0x5b 50 0062 0x32 59 0073 0x3b 53 0065 0x35 126 0176 0x7e But this one: { "command": { "action": "sendInput", "input": "\u001b[\u0032\u0037\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" } does not send anything. I may need to learn how the input param is being processed.
Author
Owner

@DHowett commented on GitHub (Jan 29, 2021):

Strange enough, your second binding does work for me.

image

image

@DHowett commented on GitHub (Jan 29, 2021): Strange enough, your second binding _does_ work for me. ![image](https://user-images.githubusercontent.com/189190/106223543-76242100-6196-11eb-9132-65a62d540f76.png) ![image](https://user-images.githubusercontent.com/189190/106223529-702e4000-6196-11eb-9c4d-3ef80a8cb0b9.png)
Author
Owner

@tmtom commented on GitHub (Jan 29, 2021):

Actually it seems we are both right. For me it is working for WSL but not for SSH.
I have WSL2:
{
"guid": "{a8202b0e-781a-5dab-98e2-e9d469a63619}",
"hidden": false,
"name": "CentOS7",
"source": "Windows.Terminal.Wsl"
},

and SSH (here Centos in local Hyper-V, tried also real Ubuntu):
{
"guid": "{a8202b0e-781a-5dab-98e2-e9d439a63619}",
"hidden": false,
"name": "MavCentos",
"commandline": "ssh tom@mav-centos-7.mshome.net"
},

Add indeed this binding:
{ "command": { "action": "sendInput", "input": "\u001b[\u0032\u0037\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" }

is working for WSL but in the SSH session 'showkey -a' does not show any thing being received.
So do you think this is rather a problem with the SSH (OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5)?

@tmtom commented on GitHub (Jan 29, 2021): Actually it seems we are both right. For me it is working for WSL but not for SSH. I have WSL2: { "guid": "{a8202b0e-781a-5dab-98e2-e9d469a63619}", "hidden": false, "name": "CentOS7", "source": "Windows.Terminal.Wsl" }, and SSH (here Centos in local Hyper-V, tried also real Ubuntu): { "guid": "{a8202b0e-781a-5dab-98e2-e9d439a63619}", "hidden": false, "name": "MavCentos", "commandline": "ssh tom@mav-centos-7.mshome.net" }, Add indeed this binding: { "command": { "action": "sendInput", "input": "\u001b[\u0032\u0037\u003b\u0035\u003b\u0039\u007e" }, "keys": "ctrl+tab" } is working for WSL but in the SSH session 'showkey -a' does not show any thing being received. So do you think this is rather a problem with the SSH (OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5)?
Author
Owner

@zadjii-msft commented on GitHub (Jan 29, 2021):

It's entirely possible. I'm not intimately familiar with how it works, but I do recall in the past they've been one to re-parse input themselves. You might have better luck on an 8.0+ version? But I really can't say for sure.

@zadjii-msft commented on GitHub (Jan 29, 2021): It's entirely possible. I'm not intimately familiar with how it works, but I do recall in the past they've been one to re-parse input themselves. You might have better luck on an 8.0+ version? But I really can't say for sure.
Author
Owner

@tmtom commented on GitHub (Jan 29, 2021):

You were right. Latest version (v8.1.0.0p1-Beta) of OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases did the trick. So after cleaning this binding makes Ctrl-Tab work in ssh:

{ "command": { "action": "sendInput", "input": "\u001b[27;5;9~" }, "keys": "ctrl+tab" }

Thank you very much for your support and patience. We can close the ticket.

@tmtom commented on GitHub (Jan 29, 2021): You were right. Latest version (v8.1.0.0p1-Beta) of OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases did the trick. So after cleaning this binding makes Ctrl-Tab work in ssh: { "command": { "action": "sendInput", "input": "\u001b[27;5;9~" }, "keys": "ctrl+tab" } Thank you very much for your support and patience. We can close the ticket.
Author
Owner

@zadjii-msft commented on GitHub (Jan 29, 2021):

awesome, happy to help!

@zadjii-msft commented on GitHub (Jan 29, 2021): awesome, happy to help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12255