Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DHowett opened this issue Aug 31, 2023 · 6 comments
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Milestone

Comments

@DHowett
Copy link
Member

DHowett commented Aug 31, 2023

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.
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 31, 2023
@elsaco
Copy link

elsaco commented Sep 2, 2023

Screenshot using Win10 and latest WinDev2308Eval vm:

wt_bug_15919

@carlos-zamora carlos-zamora added Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Sep 6, 2023
@carlos-zamora carlos-zamora added this to the Backlog milestone Sep 6, 2023
@zadjii-msft
Copy link
Member

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
Copy link

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
Copy link
Member

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
Copy link
Member

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:

  • The buffer in VtInputThread::DoReadInput is 256 chars. It looks to me like there was about 317 that got written before the input sequence got chopped.
  • We could maybe be even smarter, and if we read a whole buffer worth of chars, then keep reading till we run out, then pump the string into the state machine to process.
  • More aggressively flush the WriteFile on the Terminal side?

@zadjii-msft
Copy link
Member

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.

@zadjii-msft zadjii-msft added the Help Wanted We encourage anyone to jump in on these. label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

5 participants