microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.86k stars 8.21k forks source link

`keybindings` of dead keys using AltGr+X #10218

Open gpotter2 opened 3 years ago

gpotter2 commented 3 years ago

Windows Terminal version (or Windows build number)

1.9.1445.0

Steps to reproduce

The AZERTY keyboard for context:

Actual Behavior

Both ^ and ~ keys are dead keys.

Comments

This issue follows my previous https://github.com/microsoft/terminal/issues/5784 issue. TBF, this is the edge case of an edge case, and I would understand if this never got fixed... I'm just secretly hoping for another @lhecker miracle šŸ˜„ but can probably live without it

eElor commented 3 years ago

Thanks for the "un-deadifying-of-keys" idea. I almost got crazy today after updating from 1.6.10571.0 to 1.7.X / 1.8.X / 1.9.X and noticing that despite having altGrAliasing turned on, I couldn't input any of { [ ] by Ctrl-Alting them. Reading through the issues, I noticed this problem pops up every now and then... Following solved the issue (not a very nice solution though šŸ™ˆ Probably there are also other dead keys I will need to wake up ... )

...
         {
            "command": {
                "action": "sendInput",
                "input": "{"
            },
            "keys": "{"
        },
        {
            "command": {
                "action": "sendInput",
                "input": "["
            },
            "keys": "["
        },
        {
            "command": {
                "action": "sendInput",
                "input": "]"
            },
            "keys": "]"
        }
...
lhecker commented 3 years ago

@gpotter2 What language are you using the AZERTY layout with? For French AZERTY AltGr+9 (^) is not a dead key.

lhecker commented 3 years ago

Oh and there's also this comment: https://github.com/microsoft/terminal/blob/d7f2a39aeb0016bcacaa7ccf1b880d7adedcea46/src/cascadia/TerminalControl/TermControl.cpp#L885-L887

gpotter2 commented 3 years ago

@gpotter2 What language are you using the AZERTY layout with? For French AZERTY AltGr+9 (^) is not a dead key.

There is another one accessible with a single keypress (in red on the picture, near the enter key)

lhecker commented 3 years ago

@gpotter2 Just to explain my previous comment a bit better: This issue exists due to https://github.com/microsoft/terminal/pull/2235 For instance if you use a German keyboard Ctrl+Alt+7 and AltGr+7 will both produce the rather important character {. Since WT's settings don't differentiate between left and right Alt, it doesn't differentiate between Ctrl+Alt and AltGr. https://github.com/microsoft/terminal/pull/2235 prevents AltGr+combinations from ever reaching your keybinding settings, allowing you to have a key binding for Ctrl+Alt+7 (aka "focus tab 7") while simultaneously being able to press AltGr+7 to write a {.

Fixing this issue is very complicated and quite likely requires us to change the meaning of the "Ctrl" and "Alt" keywords when writing key bindings, in order to resolve the conflict with AltGr. I don't know what the best course of action is. Preferably it should be something that doesn't break existing work flows of our users.

gpotter2 commented 3 years ago

I see. That's very clear thank you. Understandably being able to bind Ctrl+Alt+? to shortcuts is much more important than overriding altgr shortcuts.

The obvious solution would be for WSL to be able to differentiate altgr and alt but that's of course more easily said than done.