Tab key yields an extra keypress #14499

Closed
opened 2026-01-31 04:11:55 +00:00 by claunia · 11 comments
Owner

Originally created by @ericsink on GitHub (Jul 13, 2021).

Windows Terminal version (or Windows build number)

1.8.1521.0

Other Software

Windows Version 10.0.19042 Build 19042

Steps to reproduce

(I'm not sure this is the right place to post this, but I'm at the end of my rope. The problem is likely very uncommon, perhaps even special to my machine, but it is very specific to Windows Terminal, so I'm posting here to see if this looks familiar to anyone. Perhaps I'll get a clue to help diagnose this.)

The problem: Inside Windows Terminal, whenever I press the TAB key, I get two of them.

On MY machine (tm), the "steps to reproduce" are:

  1. Open Windows Terminal
  2. Open a tab with WSL
  3. type 'ls' and press the TAB key

The bash completion behaves as if the TAB were pressed twice.

For a while, I thought this was a problem in my bash configuration. But the problem happens in cmd.exe or PowerShell, if they are running in Windows Terminal. I have 3 different Ubuntu versions in wsl, and they all exhibit the behavior when under Windows Terminal.

If I open cmd.exe or Powershell the old fashoned way, without Windows Terminal, the behavior does not appear.

Running WSL from an old-fashioned cmd.exe window results in bash tab completion working the normal way, ie, the double-keypress problem is not seen.

The following C# test program simply echoes keystrokes. Running it from within Windows Terminal (WSL, cmd.exe, powershell, whatever) yields two lines for each press of the TAB key. No such problems running it in regular cmd.exe.

    class Program
    {
        static void Main(string[] args)
        {
		while (true)
		{
			var x = Console.ReadKey();
			Console.WriteLine($"{x}");
		}
        }
    }

I have checked my settings.json, and I see nothing that seems likely to cause this. As an experiment, I deleted my settings.json completely and restarted Windows Terminal, and the problem persists (with a newly created settings.json file). I could post my settings.json if it would be helpful.

I have rebooted my machine, no change. I have installed updates, no change.

I cannot report when this problem appeared. IIRC, the problem was happening when I first tried Windows Terminal, quite some time ago, probably shortly after its initial release. Because it's so annoying, I gave up on Windows Terminal and went back to something else. Now I'm trying again, and I'd like to try harder to get Windows Terminal to work without this "rock in my shoe".

Thanks in advance for any assistance. :-)

Expected Behavior

Just one tab keypress.

Actual Behavior

Two tab keypresses (see above).

Originally created by @ericsink on GitHub (Jul 13, 2021). ### Windows Terminal version (or Windows build number) 1.8.1521.0 ### Other Software Windows Version 10.0.19042 Build 19042 ### Steps to reproduce (I'm not sure this is the right place to post this, but I'm at the end of my rope. The problem is likely very uncommon, perhaps even special to my machine, but it is very specific to Windows Terminal, so I'm posting here to see if this looks familiar to anyone. Perhaps I'll get a clue to help diagnose this.) The problem: Inside Windows Terminal, whenever I press the TAB key, I get two of them. On MY machine (tm), the "steps to reproduce" are: 1. Open Windows Terminal 2. Open a tab with WSL 3. type 'ls' and press the TAB key The bash completion behaves as if the TAB were pressed twice. For a while, I thought this was a problem in my bash configuration. But the problem happens in cmd.exe or PowerShell, if they are running in Windows Terminal. I have 3 different Ubuntu versions in wsl, and they all exhibit the behavior when under Windows Terminal. If I open cmd.exe or Powershell the old fashoned way, without Windows Terminal, the behavior does not appear. Running WSL from an old-fashioned cmd.exe window results in bash tab completion working the normal way, ie, the double-keypress problem is not seen. The following C# test program simply echoes keystrokes. Running it from within Windows Terminal (WSL, cmd.exe, powershell, whatever) yields two lines for each press of the TAB key. No such problems running it in regular cmd.exe. ``` class Program { static void Main(string[] args) { while (true) { var x = Console.ReadKey(); Console.WriteLine($"{x}"); } } } ``` I have checked my settings.json, and I see nothing that seems likely to cause this. As an experiment, I deleted my settings.json completely and restarted Windows Terminal, and the problem persists (with a newly created settings.json file). I could post my settings.json if it would be helpful. I have rebooted my machine, no change. I have installed updates, no change. I cannot report when this problem appeared. IIRC, the problem was happening when I first tried Windows Terminal, quite some time ago, probably shortly after its initial release. Because it's so annoying, I gave up on Windows Terminal and went back to something else. Now I'm trying again, and I'd like to try harder to get Windows Terminal to work without this "rock in my shoe". Thanks in advance for any assistance. :-) ### Expected Behavior Just one tab keypress. ### Actual Behavior Two tab keypresses (see above).
Author
Owner

@DHowett commented on GitHub (Jul 13, 2021):

YES! Something the debug tap and "forceVT" can possibly help with.

Can you try the following:

Open your settings.json file (shift-click the Settings menu item), and add the following to the global section (next to stuff like copyOnSelect and showTabsInTitleBar)

"experimental.input.forceVT": true,

If that solves it: Good! Also bad!

If that doesn't solve it, remove that setting.

Either way, add this:

"debugFeatures": true,

this will not impact the performance of your Terminal or leak any sensitive information, don't worry!

After you've done that: hold down left and right alt and click the WSL profile in the new tab dropdown.

You should see something like this...

image

What shows up in red when you press TAB?

@DHowett commented on GitHub (Jul 13, 2021): YES! Something the debug tap and "forceVT" can possibly help with. Can you try the following: Open your settings.json file (shift-click the Settings menu item), and add the following to the global section (next to stuff like copyOnSelect and showTabsInTitleBar) ```json "experimental.input.forceVT": true, ``` If that solves it: Good! Also bad! If that doesn't solve it, remove that setting. Either way, add this: ```json "debugFeatures": true, ``` _this will not impact the performance of your Terminal or leak any sensitive information, don't worry!_ After you've done that: hold down *left and right alt* and click the WSL profile in the new tab dropdown. You should see something like this... ![image](https://user-images.githubusercontent.com/189190/125368798-aaecf480-e340-11eb-8122-bb961a36ce81.png) What shows up in red when you press TAB?
Author
Owner

@ericsink commented on GitHub (Jul 13, 2021):

(Thanks for the reply!)

The forceVT setting did not seem to make a difference.

I added the debugFeatures setting and followed the steps toward:

What shows up in red when you press TAB?

resulting in:

image

@ericsink commented on GitHub (Jul 13, 2021): (Thanks for the reply!) The `forceVT` setting did not seem to make a difference. I added the `debugFeatures` setting and followed the steps toward: > What shows up in red when you press TAB? resulting in: ![image](https://user-images.githubusercontent.com/3877005/125371239-ed650000-e345-11eb-8b8c-e7ee4de7af7d.png)
Author
Owner

@zadjii-msft commented on GitHub (Jul 13, 2021):

Well that's not right. There's seemingly two tabs being sent! The first is the ␛[9;15;9;1;0;1_, the second is the .

These are random questions:

  • Are you using the on-screen keyboard of the touch keyboard?
  • What keyboard layout are you using?
@zadjii-msft commented on GitHub (Jul 13, 2021): Well that's not right. There's seemingly two tabs being sent! The first is the `␛[9;15;9;1;0;1_`, the second is the `␉`. These are random questions: * Are you using the on-screen keyboard of the touch keyboard? * What keyboard layout are you using?
Author
Owner

@DHowett commented on GitHub (Jul 13, 2021):

Whoa! That HT escaped my notice. Good eye, @zadjii-msft!

@DHowett commented on GitHub (Jul 13, 2021): Whoa! That `HT` escaped my notice. Good eye, @zadjii-msft!
Author
Owner

@ericsink commented on GitHub (Jul 15, 2021):

(Darn it! Sorry for the slow reply, I missed the notification on this.)

No, this is not a touch screen. It's a regular keyboard on a Lenovo ThinkPad P53 laptop.

The keyboard layout? Er, whatever the default is. Lemme check...

Looks like it's "US QWERTY".

@ericsink commented on GitHub (Jul 15, 2021): (Darn it! Sorry for the slow reply, I missed the notification on this.) No, this is not a touch screen. It's a regular keyboard on a Lenovo ThinkPad P53 laptop. The keyboard layout? Er, whatever the default is. Lemme check... Looks like it's "US QWERTY".
Author
Owner

@ericsink commented on GitHub (Jul 15, 2021):

FWIW, I ran another experiment, wherein I removed Windows Terminal from my machine and re-installed it.

No change.

@ericsink commented on GitHub (Jul 15, 2021): FWIW, I ran another experiment, wherein I removed Windows Terminal from my machine and re-installed it. No change.
Author
Owner

@ericsink commented on GitHub (Jul 16, 2021):

More things that made no difference: I updated all the drivers and BIOS for my laptop. And I updated to Windows 21H1 (10.0.19043).

@ericsink commented on GitHub (Jul 16, 2021): More things that made no difference: I updated all the drivers and BIOS for my laptop. And I updated to Windows 21H1 (10.0.19043).
Author
Owner

@ericsink commented on GitHub (Jul 16, 2021):

And I couldn't shake the worry that "clink" (1) was the problem, so I uninstalled it. No change.

(1) https://github.com/chrisant996/clink

@ericsink commented on GitHub (Jul 16, 2021): And I couldn't shake the worry that "clink" (1) was the problem, so I uninstalled it. No change. (1) https://github.com/chrisant996/clink
Author
Owner

@DHowett commented on GitHub (Jul 16, 2021):

Wow, thank you for the thorough investigation! We may need to get you a different build of Terminal that will cough up more diagnostics, unfortunately. We'll chat about it at team sync in a couple days. 😄

@DHowett commented on GitHub (Jul 16, 2021): Wow, thank you for the thorough investigation! We may need to get you a different build of Terminal that will cough up more diagnostics, unfortunately. We'll chat about it at team sync in a couple days. :smile:
Author
Owner

@ericsink commented on GitHub (Oct 5, 2021):

I've spent much of my long career preaching that a bug isn't "done" until its cause and solution are fully understood. So I cringe at myself when I report to you:

I installed Windows 11 and this problem Went Away.

@ericsink commented on GitHub (Oct 5, 2021): I've spent much of my long career preaching that a bug isn't "done" until its cause and solution are fully understood. So I cringe at myself when I report to you: I installed Windows 11 and this problem Went Away.
Author
Owner

@zadjii-msft commented on GitHub (Oct 5, 2021):

Gosh, don't you just hate when that happens 😢 I would have loved to know the root cause myself. It wasn't the shell, it wasn't the keyboard layout, it wasn't the on-screen keyboard - all likely suspects but those didn't seem like the cause here.

Since you were the only one who ever had a repro, and the problem's been fixed, I'm not sure there's much else we can do here. If anyone else ever encounters this though, we'll keep our eyes open!

@zadjii-msft commented on GitHub (Oct 5, 2021): Gosh, don't you just hate when that happens 😢 I would have loved to know the root cause myself. It wasn't the shell, it wasn't the keyboard layout, it wasn't the on-screen keyboard - all likely suspects but those didn't seem like the cause here. Since you were the only one who ever had a repro, and the problem's been fixed, I'm not sure there's much else we can do here. If anyone else ever encounters this though, we'll keep our eyes open!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14499