microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.45k stars 8.3k forks source link

Spurious ";1_" printed to screen when clicking on Terminal in a Hyper-V basic session #15919

Open DHowett opened 1 year ago

DHowett commented 1 year ago

This has been happening for quite a while, and I bet there's a pretty simple explanation.

It might happen when you activate the Hyper-V vmconnect window.

Admittedly, I can't reproduce it on the Windows Evaluation VM with 1.17 to grab a screenshot, but it has happened to me enough times that I know it's lurking in there.


  1. Start a VM running Windows 11+
  2. Connect to it in Virtual Machine Connection, rejecting the enhanced session prompt
  3. Launch Terminal
  4. Focus on something other than the VMC window.
  5. Click on the Terminal window within the VMC window.
  6. Observe ;1_ is typed.
elsaco commented 1 year ago

Screenshot using Win10 and latest WinDev2308Eval vm:

wt_bug_15919

zadjii-msft commented 1 year ago

Hey @elsaco since you can get a live repro - can you grab a debug tap trace? That should include the actual key that's causing this in red text.

joncarmsft commented 1 year ago
PS␣C:\Users\Jon>␣␛[9;15;9;0;0;1_␛[16;42;0;0;0;1_␛[16;54;0;0;256;1_␛[17;29;0;0;0;1_␛[17;29;0;0;256;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[9;15;9;0;0;1_␛[16;42;0;0;0;1_␛[16;54;0;0;256;1_␛[17;29;0;0;0;1_␛[17;29;0;0;256;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[37m;␛[93m1_␛[m␛[9;15;9;0;0;1_␛[16;42;0;0;0;1_␛[16;54;0;0;256;1_␛[17;29;0;0;0;1_␛[17;29;0;0;256;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[44;55;0;0;256;1_␛[9;15;9;0;0;1_␛[16;42;0;0;0;1_␛[16;54;0;0;256;1_␛[17;29;0;0;0;1_␛[17;29;0;0;256;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[9;15;9;0;0;1_␛[16;42;0;0;0;1_␛[16;54;0;0;256;1_␛[17;29;0;0;0;1_␛[17;29;0;0;256;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[18;56;0;0;0;1_␛[9;15;9;0;0;1_␛[O

In the above everything is red, except PS␣C:\Users\Jon> and ␛[37m;␛[93m1_␛[m is white.

zadjii-msft commented 1 year ago

everything before the ;1_

Vk Sc Uc Kd Cs
VK_TAB 15 9 up 0
VK_SHIFT 42 0 up 0
VK_SHIFT 54 0 up 256
VK_CONTROL 29 0 up 0
VK_CONTROL 29 0 up 256
VK_TAB 15 9 up 0
VK_MENU 56 0 up 0
VK_TAB 15 9 up 0
VK_MENU 56 0 up 0
VK_TAB 15 9 up 0
VK_TAB 15 9 up 0
VK_SHIFT 42 0 up 0
VK_SHIFT 54 0 up 256
VK_CONTROL 29 0 up 0
VK_CONTROL 29 0 up 256
VK_TAB 15 9 up 0
VK_MENU 56 0 up 0
VK_TAB 15 9 up 0
VK_MENU 56 0 up 0
VK_TAB 15 9 up 0
zadjii-msft commented 1 year ago

I'm trying to find the thread I'm thinking of

It might not be that exactly. Looks like this was a super long input sequence that got chopped at some point, and then conpty only got a part of a sequence. Interesting to me that ;1_ was all that got printed. Does that mean conpty read the preceeding ␛[9;15;9;0;0, got to the end of the input , then just ignored the sequence? Maybe. I'd have to cache that back in.

There's some other silly things we might be able to do to mitigate this:

zadjii-msft commented 1 year ago

As @DHowett observed in chat: image

There is a ;1_ that lines up exactly with the 255 boundary. I should have been looking that way, not at the length before it was echoed to the screen.