[PR #4940] [MERGED] Fix C-M-z, C-M-x in Conpty #26041

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4940
Author: @zadjii-msft
Created: 3/16/2020
Status: Merged
Merged: 3/16/2020
Merged by: @undefined

Base: masterHead: dev/migrie/b/4201-C-M-z


📝 Commits (1)

  • 4bce276 Fix C-M-z, C-M-x in Conpty

📊 Changes

2 files changed (+73 additions, -2 deletions)

View changed files

📝 src/terminal/parser/stateMachine.cpp (+7 -2)
📝 src/terminal/parser/ut_parser/InputEngineTest.cpp (+66 -0)

📄 Description

Summary of the Pull Request

This PR ensures that Conpty properly treats ^[^Z and ^[^X as
Ctrl+Alt+z and Ctrl+Alt+x, instead of Ctrl+z
and Ctrl+x.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

^Z and ^X are special control characters, SUB and CAN. For the output state
machine, these characters are supposed to be executed from any state. However,
we shouldn't do this for the input engine. With the current behavior, these
characters are immediately executed regardless of what state we're in. That
means we end up synthesizing Ctrl+z/x for these characters. However,
for the InputStateMachine engine, when these characters are preceeded by ^[
(ESC), we want to treat them as Ctrl+Alt+z/x.

This just adds a check in StateMachine to see if we should immediately execute
these characters from any state, similar to many of the other exceptions we
already perform in the StateMachine for the input engine.

Validation Steps Performed

  • ran tests
  • checked showkey -a in gnome-terminal
  • checked showkey -a in conhost
  • checked showkey -a in vt pipeterm (conhost as a conpty terminal)
  • checked showkey -a in Windows Terminal

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/4940 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 3/16/2020 **Status:** ✅ Merged **Merged:** 3/16/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/migrie/b/4201-C-M-z` --- ### 📝 Commits (1) - [`4bce276`](https://github.com/microsoft/terminal/commit/4bce2765acfed297e3aad3e9d39a9643b10c553c) Fix C-M-z, C-M-x in Conpty ### 📊 Changes **2 files changed** (+73 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/terminal/parser/stateMachine.cpp` (+7 -2) 📝 `src/terminal/parser/ut_parser/InputEngineTest.cpp` (+66 -0) </details> ### 📄 Description ## Summary of the Pull Request This PR ensures that Conpty properly treats `^[^Z` and `^[^X` as <kbd>Ctrl+Alt+z</kbd> and <kbd>Ctrl+Alt+x</kbd>, instead of <kbd>Ctrl+z</kbd> and <kbd>Ctrl+x</kbd>. ## References ## PR Checklist * [x] Closes #4201 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments `^Z` and `^X` are special control characters, SUB and CAN. For the output state machine, these characters are supposed to be executed from _any_ state. However, we shouldn't do this for the input engine. With the current behavior, these characters are immediately executed regardless of what state we're in. That means we end up synthesizing <kbd>Ctrl+z/x</kbd> for these characters. However, for the InputStateMachine engine, when these characters are preceeded by `^[` (ESC), we want to treat them as <kbd>Ctrl+Alt+z/x</kbd>. This just adds a check in `StateMachine` to see if we should immediately execute these characters from any state, similar to many of the other exceptions we already perform in the StateMachine for the input engine. ## Validation Steps Performed * ran tests * checked `showkey -a` in gnome-terminal * checked `showkey -a` in conhost * checked `showkey -a` in vt pipeterm (conhost as a conpty terminal) * checked `showkey -a` in Windows Terminal --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:13:34 +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#26041