Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to type characters with AltGr modifier #595

Closed
CptPotato opened this issue Aug 16, 2021 · 16 comments
Closed

Unable to type characters with AltGr modifier #595

CptPotato opened this issue Aug 16, 2021 · 16 comments
Labels
A-keymap Area: Keymap and keybindings C-bug Category: This is a bug O-windows Operating system: Windows

Comments

@CptPotato
Copy link
Contributor

CptPotato commented Aug 16, 2021

As of helix 0.4.0 I'm unable to type any characters that require the AltGr modifier key.
This appears to be a regression somewhere between version 0.3.0 and 0.4.0 of helix.

Environment

  • Platform: Win10 x64
  • Helix version: 0.4.0/0.4.1 (from Github releases)
@CptPotato CptPotato added the C-bug Category: This is a bug label Aug 16, 2021
@pickfire pickfire added the A-keymap Area: Keymap and keybindings label Aug 17, 2021
@CptPotato
Copy link
Contributor Author

A quick bisect points to 8a2fa69 (merged in #521) causing this new behaviour.

@archseer
Copy link
Member

Good catch! Looks like the if self.modifiers.is_empty() check should be removed. All the code previously ignored modifiers, but now it explicitly looks for no modifier present.

@CptPotato
Copy link
Contributor Author

CptPotato commented Aug 26, 2021

Thanks! I can confirm that AltGr works again as expected in INS mode.

One more issue, though: It does not work in the command line at the bottom (i.e. entering :-commands, searching, etc.).
With my keyboard this means not being able to enter {[]}\|@ there, so only the search function is a bit limited for now.

Edit: The same goes for the file picker.

@archseer
Copy link
Member

I'll fix up the Prompt component, it should take care of all the remaining cases :)

@CptPotato
Copy link
Contributor Author

CptPotato commented Sep 21, 2021

It appears that the fix for prompts in 5cee3b6 (l. 530-537) doesn't work as expected.
To be more precise, AltGr seems to be interpreted as Ctrl + Alt* and won't pass the check in prompt.rs:534.

* I think this is a common thing, but I'm not 100% sure

I tested it with the following change and I'm now getting the "correct" behaviour. This might need more thought, however... I'm not sure if this breaks other input combinations or works differently on different OS.

/* ... */

    } if !modifiers.contains(KeyModifiers::CONTROL)
        || modifiers.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) =>
    {
        self.insert_char(c);
        (self.callback_fn)(cx, &self.line, PromptEvent::Update);
    }

/* ... */

@CptPotato
Copy link
Contributor Author

@archseer sorry for pinging but I want to mention again that this issue isn't fully fixed, see my previous comment.

Maybe it's better to keep the issue open for now?

@archseer
Copy link
Member

Sorry, I somehow completely missed the last message! Reopening and will take a look at the patch.

@KlasMvW
Copy link

KlasMvW commented Feb 19, 2022

Is there a plan for a patch for this? I understand if Windows is not a priority platform but Helix is a such a great editor and the only select-based editor for Windows AFAIK. The AltGr characters are essential for regex so it would be nice to have it fixed.

@CptPotato
Copy link
Contributor Author

This might also be a crossterm issue, depending on what the expected behavior is.

For example, on a german keyboard layout AltGr + q is used to type @.
However, crossterm reports this as:

KeyEvent { code: Char('@'), modifiers: CONTROL | ALT }

So on top of the "resolved" character @ there's the additional Ctrl + Alt modifiers that interfere with how helix handles the inputs in the prompt component.

@archseer
Copy link
Member

Hmm, looks like ctrl + alt sequence has special meaning as alt gr: https://devblogs.microsoft.com/oldnewthing/20040329-00/?p=40003

@archseer
Copy link
Member

Sorry for the great delay on this, I've removed the limitation on the prompt.

@CptPotato
Copy link
Contributor Author

Sorry for the great delay on this, I've removed the limitation on the prompt.

No worries. I can confirm that it works correctly now 👍

@mscofield0
Copy link

helix 22.05 (27609f5)
I'm still having issues in the newer versions.

@CptPotato
Copy link
Contributor Author

@mscofield0 are you experiencing this with writing text or with keybinds?

I did notice something, too:

I can type characters with AltGr modifier just fine. But key bindings that require this modifier (such as | for pipe) don't work on windows.

@mscofield0
Copy link

Yep, same issue here. Key bindings don't work (normal mode), but typing works just fine.

@CptPotato
Copy link
Contributor Author

Alright, I'll create a new issue for this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-keymap Area: Keymap and keybindings C-bug Category: This is a bug O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

5 participants