Shift key not working properly in some situations #3895

Closed
opened 2026-01-30 23:32:44 +00:00 by claunia · 6 comments
Owner

Originally created by @iCodeSometime on GitHub (Sep 16, 2019).

Environment

Windows build number: 10.0.18362.0
Windows Terminal version (if applicable): 0.4.2382.0

Any other software? wsl + emacs

Steps to reproduce

  1. Open emacs within wsl in Windows Terminal.
  2. Type either of the following:
    • M-> (alt + greater than) to move to the end of the file
    • M-< (alt + less than) to move to the beginning of the file
  3. Verify the key emacs is seeing, by typing C-h k (Ctrl+h, k) for describe key - then type either of the above key combinations.

Expected behavior

M-> moves to the end of the file.
M-< moves to the beginning of the file.
C-h k M-> displays M-> as the command run.
C-h k M-< displays M-< as the command run.

Actual behavior

M-> does not move to the end of the file.
M-< does not move to the beginning of the file.
C-h k M-> displays M-. as the command run.
C-h k M-< displays M-, as the command run.

Originally created by @iCodeSometime on GitHub (Sep 16, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18362.0 Windows Terminal version (if applicable): 0.4.2382.0 Any other software? wsl + emacs ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. Open emacs within wsl in Windows Terminal. 2. Type either of the following: - M-> (alt + greater than) to move to the end of the file - M-< (alt + less than) to move to the beginning of the file 3. Verify the key emacs is seeing, by typing C-h k (Ctrl+h, k) for describe key - then type either of the above key combinations. # Expected behavior M-> moves to the end of the file. M-< moves to the beginning of the file. C-h k M-> displays M-> as the command run. C-h k M-< displays M-< as the command run. <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior M-> does not move to the end of the file. M-< does not move to the beginning of the file. C-h k M-> displays M-. as the command run. C-h k M-< displays M-, as the command run. <!-- What's actually happening? -->
Author
Owner

@iCodeSometime commented on GitHub (Sep 16, 2019):

To be clear, this all works properly when I use my wsl instance from outside of the new windows terminal app.

@iCodeSometime commented on GitHub (Sep 16, 2019): To be clear, this all works properly when I use my wsl instance from outside of the new windows terminal app.
Author
Owner

@zadjii-msft commented on GitHub (Sep 19, 2019):

I'm moving this to the Terminal 1.0 milestone because it seems this only repros in the Windows Terminal. It doesn't repro if you use WSL to launch cmd.exe, then launch wsl emacs. That set of steps would activate conpty. Since it doesn't repro with conhost acting as the terminal, we can rule our conpty as the source of the bug.

It'll still get fixed, but we don't need to worry about getting it into the OS for 20H1.

IIRC @lhecker did some work in this area previously.

@zadjii-msft commented on GitHub (Sep 19, 2019): I'm moving this to the Terminal 1.0 milestone because it seems this only repros in the Windows Terminal. It _doesn't_ repro if you use WSL to launch cmd.exe, then launch `wsl emacs`. That set of steps would activate conpty. Since it doesn't repro with conhost acting as the terminal, we can rule our conpty as the source of the bug. It'll still get fixed, but we don't need to worry about getting it into the OS for 20H1. IIRC @lhecker did some work in this area previously.
Author
Owner

@lhecker commented on GitHub (Sep 19, 2019):

@zadjii-msft Yeah this problem is basically tangential to the AltGr issues.
We have the vkey and modifier states in the UWP code readily available, but when we map it for the old NT console subsystem we throw away the modifier states here: 7128e873a4/src/cascadia/TerminalCore/Terminal.cpp (L225)
This causes the logic here to malfunction where the assumption is made that the char data is already pretranslated: 7128e873a4/src/terminal/input/terminalInput.cpp (L428)
Due to this I added the circumvention logic for AltGr in the UWP side of things. I guess it's time to find a proper solution for this?

@lhecker commented on GitHub (Sep 19, 2019): @zadjii-msft Yeah this problem is basically tangential to the AltGr issues. We have the vkey and modifier states in the UWP code readily available, but when we map it for the old NT console subsystem we throw away the modifier states here: https://github.com/microsoft/terminal/blob/7128e873a449a6a4c2e5680de1eb82c395ed603d/src/cascadia/TerminalCore/Terminal.cpp#L225 This causes the logic here to malfunction where the assumption is made that the char data is already pretranslated: https://github.com/microsoft/terminal/blob/7128e873a449a6a4c2e5680de1eb82c395ed603d/src/terminal/input/terminalInput.cpp#L428 Due to this I added the circumvention logic for AltGr in the UWP side of things. I guess it's time to find a proper solution for this?
Author
Owner

@lhecker commented on GitHub (Sep 19, 2019):

I read up on this a bit and it appears to me that we can map the vkey to the pretranslated character using a combination of MapVirtualKey(vkey, MAPVK_VK_TO_VSC) with ToUnicode(...).
Afterwards we should be able to remove the special handling for AltGr.

(I still don't quite understand the full architecture, but I keep wondering for what technical reason the terminalInput class is being used. If it's just for code sharing purposes, we should probably split the input handling up, so we don't have to rely on the above.)

@lhecker commented on GitHub (Sep 19, 2019): I read up on this a bit and it appears to me that we can map the vkey to the pretranslated character using a combination of `MapVirtualKey(vkey, MAPVK_VK_TO_VSC)` with `ToUnicode(...)`. Afterwards we should be able to remove the special handling for AltGr. (I still don't quite understand the full architecture, but I keep wondering for what technical reason the `terminalInput` class is being used. If it's just for code sharing purposes, we should probably split the input handling up, so we don't have to rely on the above.)
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 1, 2019):

Fixed in #2836.

@DHowett-MSFT commented on GitHub (Oct 1, 2019): Fixed in #2836.
Author
Owner

@ghost commented on GitHub (Oct 4, 2019):

:tada:This issue was addressed in #2836, which has now been successfully released as Windows Terminal Preview v0.5.2762.0.🎉

Handy links:

@ghost commented on GitHub (Oct 4, 2019): :tada:This issue was addressed in #2836, which has now been successfully released as `Windows Terminal Preview v0.5.2762.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.5.2762.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?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#3895