Terminal reports no longer work in Vttest #18677

Closed
opened 2026-01-31 06:21:01 +00:00 by claunia · 5 comments
Owner

Originally created by @j4james on GitHub (Oct 13, 2022).

Windows Terminal version

Commit cacf66860f

Windows build number

10.0.19044.2006

Other Software

Vttest

Steps to reproduce

  1. Open a WSL shell in conhost or Terminal
  2. Run vttest.
  3. Select the Private Device Attributes test (menu 6.4).

Expected Behavior

The report received from the terminal should be:

<27> [ ? 1 ; 0 c

Actual Behavior

In conhost it only seems to receive the initial ESC character, while in Terminal it receives nothing at all. And it's not just DA - other reports fail in a similar way.

I think this regression was caused by the recent DECARM merge (PR #13981), but I have no idea why. I'm still investigating.

The weird thing is that it works correctly in all of my own tests and applications. There's just something about the way vttest is reading the input that is causing it to fail.

Originally created by @j4james on GitHub (Oct 13, 2022). ### Windows Terminal version Commit cacf66860f6c175672b3d030dcd166e372b2a8cc ### Windows build number 10.0.19044.2006 ### Other Software Vttest ### Steps to reproduce 1. Open a WSL shell in conhost or Terminal 2. Run `vttest`. 2. Select the _Private Device Attributes_ test (menu 6.4). ### Expected Behavior The report received from the terminal should be: ``` <27> [ ? 1 ; 0 c ``` ### Actual Behavior In conhost it only seems to receive the initial `ESC` character, while in Terminal it receives nothing at all. And it's not just `DA` - other reports fail in a similar way. I think this regression was caused by the recent `DECARM` merge (PR #13981), but I have no idea why. I'm still investigating. The weird thing is that it works correctly in all of my own tests and applications. There's just something about the way vttest is reading the input that is causing it to fail.
claunia added the Needs-TriageResolution-Fix-CommittedIssue-Bug labels 2026-01-31 06:21:02 +00:00
Author
Owner

@j4james commented on GitHub (Oct 13, 2022):

OK it seems the problem is that vttest disables DECARM on startup, and our VT reports don't work when DECARM is disabled. The reason they don't work is because the report sequences are generated with fake keypresses using a virtual key code of zero. And the DECARM implementation uses the virtual key code to detect repeats of the same key, so all the characters in the response string appear to be coming from the same key.

We can probably fix this by checking both the virtual key code and the char data when determining whether we've got a repeated key. I'll give that a try now. Hopefully that won't have any unwanted side effects.

@j4james commented on GitHub (Oct 13, 2022): OK it seems the problem is that vttest disables `DECARM` on startup, and our VT reports don't work when `DECARM` is disabled. The reason they don't work is because the report sequences are generated with fake keypresses using a virtual key code of zero. And the `DECARM` implementation uses the virtual key code to detect repeats of the same key, so all the characters in the response string appear to be coming from the same key. We can probably fix this by checking both the virtual key code and the char data when determining whether we've got a repeated key. I'll give that a try now. Hopefully that won't have any unwanted side effects.
Author
Owner

@j4james commented on GitHub (Oct 13, 2022):

It's actually less complicated that I thought. The fact that all the generated key presses appear to be the same shouldn't be a problem. They always include both a press and release event, so that wouldn't typically be recognised as a repeat. The problem is that we're using a 0 virtual key code to indicate the "clean" state (i.e. when nothing has been pressed). That shouldn't normally match anything, since it's not a valid VK value, but in this case it does.

So I guess the solution is to use another value for the clean state - maybe 0xFFFF.

@j4james commented on GitHub (Oct 13, 2022): It's actually less complicated that I thought. The fact that all the generated key presses appear to be the same shouldn't be a problem. They always include both a press and release event, so that wouldn't typically be recognised as a repeat. The problem is that we're using a 0 virtual key code to indicate the "clean" state (i.e. when nothing has been pressed). That shouldn't normally match anything, since it's not a valid VK value, but in this case it does. So I guess the solution is to use another value for the clean state - maybe 0xFFFF.
Author
Owner

@DHowett commented on GitHub (Oct 13, 2022):

There's always our trusty friend, std::optional<T>!

@DHowett commented on GitHub (Oct 13, 2022): There's always our trusty friend, `std::optional<T>`!
Author
Owner

@j4james commented on GitHub (Oct 13, 2022):

There's always our trusty friend, std::optional<T>!

Yeah, that's a good idea. I was trying to keep things simple but that shouldn't add too much overhead, and feels a lot safer than making another assumption about an unused VK value.

@j4james commented on GitHub (Oct 13, 2022): > There's always our trusty friend, `std::optional<T>`! Yeah, that's a good idea. I was trying to keep things simple but that shouldn't add too much overhead, and feels a lot safer than making another assumption about an unused VK value.
Author
Owner

@ghost commented on GitHub (Jan 24, 2023):

:tada:This issue was addressed in #14216, which has now been successfully released as Windows Terminal Preview v1.17.1023.🎉

Handy links:

@ghost commented on GitHub (Jan 24, 2023): :tada:This issue was addressed in #14216, which has now been successfully released as `Windows Terminal Preview v1.17.1023`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.17.1023) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18677