[PR #14216] Make sure VT reports still work when DECARM is disabled #30003

Open
opened 2026-01-31 09:38:06 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14216

State: closed
Merged: Yes


The way DECARM was initially implemented, we checked for repeated key
presses by matching the last recorded virtual key code, and used a 0 key
code to indicate that no key was pressed. This caused the VT query
responses to fail, because they generated key events with a 0 key code,
and that would end up being detected as a repeated key that should be
suppressed.

This PR fixes that issue by using a std::optional to track the last
key code, so if no key has been pressed we can represent that with
std::nullopt, and there's no way that can be confused with a genuine
key press.

The DECARM mode was introduced in PR #13981.

Validation Steps Performed

I've manually tested in Vttest to confirm that the query reports are now
working again, even when DECARM is disabled. I've also checked that
DECARM itself it still working as expected.

Closes #14208

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14216 **State:** closed **Merged:** Yes --- The way `DECARM` was initially implemented, we checked for repeated key presses by matching the last recorded virtual key code, and used a 0 key code to indicate that no key was pressed. This caused the VT query responses to fail, because they generated key events with a 0 key code, and that would end up being detected as a repeated key that should be suppressed. This PR fixes that issue by using a `std::optional` to track the last key code, so if no key has been pressed we can represent that with `std::nullopt`, and there's no way that can be confused with a genuine key press. The `DECARM` mode was introduced in PR #13981. ## Validation Steps Performed I've manually tested in Vttest to confirm that the query reports are now working again, even when `DECARM` is disabled. I've also checked that `DECARM` itself it still working as expected. Closes #14208
claunia added the pull-request label 2026-01-31 09:38:06 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30003