[PR #3117] [MERGED] Fixed #3101: Alt+Arrow-Keys print extra characters #25249

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3117
Author: @lhecker
Created: 10/8/2019
Status: ✅ Merged
Merged: 11/13/2019
Merged by: @zadjii-msft

Base: master ← Head: fix-3101-alt-arrow-keys


📝 Commits (1)

  • 82a628e Fixed #3101: Alt+Arrow-Keys print extra characters

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 src/cascadia/TerminalCore/Terminal.cpp (+8 -2)

📄 Description

Summary of the Pull Request

This PR potentially fixes #3101.

PR Checklist

  • Closes #3101.
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

This PR fixes #3101 by setting flag 0 in ToUnicodeEx() even though the documentation says "If bit 0 is set, a menu is active.". I'm not 100% sure why it works, but it definitely does in this case.
I thought that bit 2, which claims that "keyboard state is not changed" would be sufficient to prevent this from happening, but it seems that's not the case.

I believe this PR should be verified by a developer at Microsoft who's familiar with the internal workings of ToUnicodeEx().
We need this function (or something similar) to translate Alt+Key combinations to proper unicode.
But at the same time it should not send us any additional IBM-style Alt Codes to our character handler if that translation fails (and ToUnicodeEx() returns 0).

Validation Steps Performed

See #3101 for more information. I ensured that Alt+Arrow-Key combinations do not print ◘☻♠♦ anymore.


🔄 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/3117 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 10/8/2019 **Status:** ✅ Merged **Merged:** 11/13/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `fix-3101-alt-arrow-keys` --- ### 📝 Commits (1) - [`82a628e`](https://github.com/microsoft/terminal/commit/82a628e9180e913ccbfca63b0befc05b7dc6324d) Fixed #3101: Alt+Arrow-Keys print extra characters ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+8 -2) </details> ### 📄 Description ## Summary of the Pull Request This PR potentially fixes #3101. ## PR Checklist * [x] Closes #3101. * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments This PR fixes #3101 by setting flag 0 in `ToUnicodeEx()` even though the documentation says "If bit 0 is set, a menu is active.". I'm not 100% sure why it works, but it definitely does in this case. I thought that bit 2, which claims that "keyboard state is not changed" would be sufficient to prevent this from happening, but it seems that's not the case. I believe this PR should be verified by a developer at Microsoft who's familiar with the internal workings of `ToUnicodeEx()`. We need this function (or something similar) to translate Alt+Key combinations to proper unicode. But at the same time it should not send us any additional IBM-style Alt Codes to our character handler if that translation fails (and `ToUnicodeEx()` returns 0). ## Validation Steps Performed See #3101 for more information. I ensured that Alt+Arrow-Key combinations do not print ◘☻♠♦ anymore. --- <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:08:18 +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#25249