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

Commands mapped to parenthesis or brackets don't work on Nordic keyboards #5718

Open
NordicAngel opened this issue Jan 29, 2023 · 6 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@NordicAngel
Copy link

Summary

On a Nordic keyboard (in my case danish but I think Sweden and Norway use the same layout) there are problems with accessing commands that are mapped to parenthesis or brackets e.g. rotate_selections_backward ( or add_newline_below ]. I think this is do to these characters being placed on the number keys i.e. I have to press shift-8 for an open parenthesis or alt gr-8 for a open bracket. If I try to use ( in normal mode it reads it as shift-( and I'm not even sure it can read my brackets. The commands switch_to_lowercase and switch_to_uppercase work even though I also need shift to access backtick, but they still read as shift-`.

I have gotten the reading by recording macros.

Reproduction Steps

No response

Helix log

No response

Platform

Windows

Terminal Emulator

windows cmd

Helix Version

helix 22.12 (96ff64a)

@NordicAngel NordicAngel added the C-bug Category: This is a bug label Jan 29, 2023
@CptPotato
Copy link
Contributor

I'm using a German keyboard layout and faced similar issues with helix on windows. The parenthesis/brackets mapping seems to be the same as on your layout (Shift8 / AltGr8). Using ( / ) to rotate selections works fine for me, but AltGr bindings register as CtrlAlt....

I managed to work around this, by adjusting some bindings. For example, here's the "unimpaired" bindings remapped:

"C-A-[" = { d = "goto_prev_diag", D = "goto_first_diag", f = "goto_prev_function", c = "goto_prev_class", a = "goto_prev_parameter", o = "goto_prev_comment", p = "goto_prev_paragraph", space = "add_newline_above", d = "goto_next_diag" }
"C-A-]" = { d = "goto_next_diag", D = "goto_last_diag", f = "goto_next_function", c = "goto_next_class", a = "goto_next_parameter", o = "goto_next_comment", t = "goto_next_test", t = "goto_prev_test", p = "goto_next_paragraph", space = "add_newline_below" }

@pascalkuthe
Copy link
Member

As a german I highlight recommend switching away from nordic/german keyboards for CS they wrack your hands with they gymnastics you have to perform to type brackets.

That said it would be good to fix this in helix although I am not sure if that's possible. neovim/neovim#11061 might be related

@pascalkuthe pascalkuthe added the A-helix-term Area: Helix term improvements label Jan 30, 2023
@CptPotato
Copy link
Contributor

CptPotato commented Jan 30, 2023

As a german I highlight recommend switching away from nordic/german keyboards for CS they wrack your hands with they gymnastics you have to perform to type brackets.

I agree, especially {[]} with right AltGr is a mess, whereas using CtrlAlt it's not that bad. I actually bound the unmpaired keys to ö/ä for consistency with the default layout. Getting used to all the special keys on a US layout would be a nightmare for me though, so that's about the best I can do.
In the future I intend to switch to a custom colemak layout where I've duplicated some awkward to type characters to AltGr + left hand, but I haven't tried this extensively.

Anyway, to get back on topic. I think switching to termwiz is being considered, which might fix the issue with [ being picked up as C-A-[.

@the-mikedavis
Copy link
Member

I don't have a keyboard to test it but #4939 may fix the detection for these on terminals that support the enhanced keyboard protocol.

@NordicAngel
Copy link
Author

I have already done something akin to what @CptPotato suggested and bound some of the conflicts to æ and ø instead of [ and ]. I mostly thought it would I'd raise the issue so people was aware that some key binding won't work on all keyboards as I imagine it can be an easily missed issue. I am new to terminal base editors so I appreciate the help, thanks.

@CptPotato
Copy link
Contributor

I don't have a keyboard to test it but #4939 may fix the detection for these on terminals that support the enhanced keyboard protocol.

I gave the enable-keycode-disambiguation branch a try, but it did not help with this specific issue in both Wezterm and Cmd (on Windows). It's possible that this "keyboard enhancement" feature is not available with those terminals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants