GramEditor/gram
39
991
Fork
You've already forked gram
87

"alt" maps to AltGr on MacOS, which interferes with typing åäö using eurkey #206

Closed
opened 2026年04月07日 08:51:31 +02:00 by krig · 39 comments
Owner
Copy link
Noticed this when I tried to type an "å" and nothing happened: turns out "alt-w" was mapped to "copy" in my keymap, and Gram maps "alt" to "altgr". There are several upstream issues regarding this, but no attempt to resolve it as far as I can tell: - https://github.com/zed-industries/zed/issues/22076 - https://github.com/zed-industries/zed/issues/25469 - https://github.com/zed-industries/zed/pull/12678 - https://github.com/zed-industries/zed/issues/12708 - https://github.com/zed-industries/zed/issues/52592 - https://github.com/zed-industries/zed/issues/52413 - https://github.com/zed-industries/zed/issues/12811 - https://github.com/zed-industries/zed/issues/14319 - https://github.com/zed-industries/zed/issues/14053
Contributor
Copy link

Yay! It was annoying to have to disable all of these bindings :)

Yay! It was annoying to have to disable all of these bindings :)
Contributor
Copy link

I tried this out in 2.0 and I am no longer able to use and to move word-by-word or to delete a word. I think this may have been what broke that.

I tried this out in 2.0 and I am no longer able to use <kbd>⌥</kbd> <kbd>←</kbd> and <kbd>⌥</kbd> <kbd>→</kbd> to move word-by-word or <kbd>⌥</kbd> <kbd>⌫</kbd> to delete a word. I think this may have been what broke that.
Contributor
Copy link

Curiously, and still works for moving lines.

Curiously, <kbd>⌥</kbd> <kbd>↑</kbd> and <kbd>⌥</kbd> <kbd>↓</kbd> still works for moving lines.
Author
Owner
Copy link

Hm. Yeah, could be. Maybe they send ascii codes. I can refine the check there a bit, probably.

Will try it myself and see if I can work it out as soon as I have time.

Hm. Yeah, could be. Maybe they send ascii codes. I can refine the check there a bit, probably. Will try it myself and see if I can work it out as soon as I have time.
Author
Owner
Copy link

@kramo So, the alt+arrow keybinds still work for me, but I suspect that you're on Linux? This fix is for Mac only.. but I wonder if maybe there is another dependency upgrade that may have caused issues on Linux.

What happens if you go to the keybind editor and search by keystroke?

@kramo So, the alt+arrow keybinds still work for me, but I suspect that you're on Linux? This fix is for Mac only.. but I wonder if maybe there is another dependency upgrade that may have caused issues on Linux. What happens if you go to the keybind editor and search by keystroke?
Contributor
Copy link

I'm on macOS and it's borked for me on both major English (US or ABC) layouts. It's broken with an empty keymap as well.

I'm on macOS and it's borked for me on both major English (US or ABC) layouts. It's broken with an empty keymap as well.
Contributor
Copy link

Also broken with both keys

Also broken with both <kbd>⌥</kbd> keys
Author
Owner
Copy link

Hm, I see. I wonder why it works for me. I would have thought MacOS to be more predictable :D

Hm, I see. I wonder why it works for me. I would have thought MacOS to be more predictable :D
Contributor
Copy link

Does it work for you on an English layout?

Does it work for you on an English layout?
Author
Owner
Copy link

I use Eurkey layout, will need to test with others and see..

I use Eurkey layout, will need to test with others and see..
Author
Owner
Copy link

I think I have a better way to solve this, but there is also a lot of strange language-specific code in there that I don't quite understand. I looked at the alacritty code and saw that there is a way to actually detect altgr/right option, so I will try that to see if that works.

I think I have a better way to solve this, but there is also a lot of strange language-specific code in there that I don't quite understand. I looked at the alacritty code and saw that there is a way to actually detect altgr/right option, so I will try that to see if that works.
Author
Owner
Copy link

OK yes, tested to work here at least as well as the previous fix at least. I think this should solve the issue. Just need to make sure I haven't broken the Linux build.

OK yes, tested to work here at least as well as the previous fix at least. I think this should solve the issue. Just need to make sure I haven't broken the Linux build.
Author
Owner
Copy link

@kramo Please try this version and see if it works for you:

https://ziranpub.b-cdn.net/Gram-test-bug-206-aarch64.dmg

@kramo Please try this version and see if it works for you: https://ziranpub.b-cdn.net/Gram-test-bug-206-aarch64.dmg
Contributor
Copy link

It unfortunately still doesn't work. It has the same behavior.

It unfortunately still doesn't work. It has the same behavior.
Contributor
Copy link

It's weird that you cannot reproduce the original issue, though. I'm not sure what could be different in our setups. I'm using a fairly standard macOS install, certainly nothing that interferes with input.

It's weird that you cannot reproduce the original issue, though. I'm not sure what could be different in our setups. I'm using a fairly standard macOS install, certainly nothing that interferes with input.
Author
Owner
Copy link

Do you have any key mappings that might interfere perhaps?

I have tried with Eurkey, US English and Swedish, and it works for me with all of them on both my desktop and laptop. 😖

Do you have any key mappings that might interfere perhaps? I have tried with Eurkey, US English and Swedish, and it works for me with all of them on both my desktop and laptop. 😖
Contributor
Copy link

I changed no bindings, so I have no idea... I should try on another device.

I changed no bindings, so I have no idea... I should try on another device.
Author
Owner
Copy link

Yeah I'm at a loss. I don't understand what could be different, other than some setting or keybinding. I have tried with both Seqoia and Tahoe, and both external and laptop keyboards. Works every time for me.

Yeah I'm at a loss. I don't understand what could be different, other than some setting or keybinding. I have tried with both Seqoia and Tahoe, and both external and laptop keyboards. Works every time for me.
Author
Owner
Copy link

Oh actually, maybe that's it. Which base keymap do you have configured? The default base keymap is one of the things that I changed in this version, from Emacs to VS Code (because I kept getting people coming from VS Code and being confused).

Oh actually, maybe that's it. Which base keymap do you have configured? The default base keymap is one of the things that I changed in this version, from Emacs to VS Code (because I kept getting people coming from VS Code and being confused).
Contributor
Copy link

I tried with both Emacs and VS Code and no luck. I will try on a new device now. Or rather, @monster will try on her laptop :)

I tried with both Emacs and VS Code and no luck. I will try on a new device now. Or rather, @monster will try on her laptop :)

I can reproduce it being borked on my device, with the default keymap.

I can reproduce it being borked on my device, with the default keymap.
Author
Owner
Copy link

Do you both have the same "native" language on your laptops (ie. which language is the physical keybed)? I am wondering if one of Zeds weird language-specific hacks is affecting you but not me.

Do you both have the same "native" language on your laptops (ie. which language is the physical keybed)? I am wondering if one of Zeds weird language-specific hacks is affecting you but not me.
Contributor
Copy link

Mine is US, hers is Dutch.

Mine is US, hers is Dutch.
Author
Owner
Copy link

Oh I think I’ve figured it out. I’m just a big idiot. You are using the right option key, am I right?

In my brain that’s not even an option key, on a swedish keyboard it’s a dead key / third level key. So I’ve never even tried to use it as a modifier. My concern was just not interfering with the left option key.

Anyway, IF I’m correct this should be really easy to fix.

Oh I think I’ve figured it out. I’m just a big idiot. You are using the right option key, am I right? In my brain that’s not even an option key, on a swedish keyboard it’s a dead key / third level key. So I’ve never even tried to use it as a modifier. My concern was just not interfering with the _left_ option key. Anyway, IF I’m correct this should be really easy to fix.
Contributor
Copy link

Yeah, no, sorry, neither option key works :(

Yeah, no, sorry, neither option key works :(
Author
Owner
Copy link

Hm. That’s too bad. Worst case it’s not related to this change at all and I’m looking in the wrong place entirely.

Once I have time (and if you have the patience to keep testing for me) I will make a version that lets you turn this on and off. I can make it more precise about when to prefer character input too.. but I just don’t understand why it would work for me and not either of you. It must be some setting or something..

Hm. That’s too bad. Worst case it’s not related to this change at all and I’m looking in the wrong place entirely. Once I have time (and if you have the patience to keep testing for me) I will make a version that lets you turn this on and off. I can make it more precise about when to prefer character input too.. but I just don’t understand why it would work for me and not either of you. It must be some setting or something..
Author
Owner
Copy link

@kramo Hi, please try this one when you have time: https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-2.dmg

@kramo Hi, please try this one when you have time: https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-2.dmg
Contributor
Copy link

No luck :(

I'm also not even sure this is what broke it. In any case, it would be nice for you to somehow be able to reproduce it, because this is really odd.

No luck :( I'm also not even sure this is what broke it. In any case, it would be nice for you to somehow be able to reproduce it, because this is really odd.
Contributor
Copy link

Ok, um, weird observation: control + left option works and behaves as if I just pressed option (pre 2.0), but control + right option also does nothing. So there is some difference. I don't know how relevant this is, though.

Ok, um, weird observation: control + left option works and behaves as if I just pressed option (pre 2.0), but control + right option also does nothing. So there is *some* difference. I don't know how relevant this is, though.
Author
Owner
Copy link

Huh. I really have no theory as to what is going wrong at this point. :/

Huh. I really have no theory as to what is going wrong at this point. :/

Worst case it’s not related to this change at all and I’m looking in the wrong place entirely.

I took the liberty of doing a git bisect to make sure we're looking at the right commit, and after an hour of compiling and running out of storage, it did come to the conclusion of f50c5f287d.

> Worst case it’s not related to this change at all and I’m looking in the wrong place entirely. I took the liberty of doing a `git bisect` to make sure we're looking at the right commit, and after an hour of compiling and running out of storage, it did come to the conclusion of f50c5f287dbe46d582eedf8fdae2cda4a824d1a4.
Author
Owner
Copy link

I will make this an option and add logging to see if I can make sense of it. For some reason alt+arrows/del is producing alphabetic characters on your machines but not on mine. Maybe there’s an OS-level option that differs..

I will make this an option and add logging to see if I can make sense of it. For some reason alt+arrows/del is producing alphabetic characters on your machines but not on mine. Maybe there’s an OS-level option that differs..
Author
Owner
Copy link

@kramo @monster Making it an option turned out to be a pain, but I did realize that there are two code paths. I was only updating one of them. So I have yet another attempt at fixing this for you:

https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg

@kramo @monster Making it an option turned out to be a pain, but I did realize that there are two code paths. I was only updating one of them. So I have yet another attempt at fixing this for you: https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg
Contributor
Copy link

That seems to work :)

That seems to work :)
Author
Owner
Copy link

Aw yes!

Aw yes!

I installed 2.0 this morning and this was about to drive me nuts! The fixed version works for me 👍.

I installed 2.0 this morning and this was about to drive me nuts! The fixed version works for me 👍.

https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg

I tried this version but with the default keymap "right option + delete" to erase a word doesn't work (left option works).

Some extra information in case it helps: I'm on an M1 MacBook Air running macOS 26.4.1. The keyboard looks like this. The input source is "ABC".

> https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg I tried this version but with the default keymap "right option + delete" to erase a word doesn't work (left option works). Some extra information in case it helps: I'm on an M1 MacBook Air running macOS 26.4.1. The keyboard [looks like this](https://commons.wikimedia.org/wiki/File:MacBook_M1.jpg). The input source is "ABC".
Author
Owner
Copy link

@ud2 wrote in #206 (comment):

https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg

I tried this version but with the default keymap "right option + delete" to erase a word doesn't work (left option works).

Some extra information in case it helps: I'm on an M1 MacBook Air running macOS 26.4.1. The keyboard looks like this. The input source is "ABC".

I'm adding an option to treat both option keys as alt, even when the right one produces text input. I saw that Alacritty also has this setting, so I guess it's not a trivial problem to solve.

@ud2 wrote in https://codeberg.org/GramEditor/gram/issues/206#issuecomment-14911635: > > https://ziranpub.b-cdn.net/Gram-aarch64-altgr-attempt-3.dmg > > I tried this version but with the default keymap "right option + delete" to erase a word doesn't work (left option works). > > Some extra information in case it helps: I'm on an M1 MacBook Air running macOS 26.4.1. The keyboard [looks like this](https://commons.wikimedia.org/wiki/File:MacBook_M1.jpg). The input source is "ABC". I'm adding an option to treat both option keys as alt, even when the right one produces text input. I saw that Alacritty also has this setting, so I guess it's not a trivial problem to solve.
Author
Owner
Copy link

OK option added, hopefully this should make it work for everyone :)

OK option added, hopefully this should make it work for everyone :)
Sign in to join this conversation.
No Branch/Tag specified
main
test/wgpu-on-mac
test-ci/failing-test-mac
test/failing-test-mac
test/build-on-22-04
test/wgpu-present-mode-mailbox
v2.1
test/altgr-fix-again
test/2.0.0-rc1
test/linux-build
test/objc2
v1.2.1
3.0.1
3.0.0
2.2.0
2.1.2
2.1.1
2.1.0
2.0.0
1.2.1
1.2.0
1.1.0
1.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
GramEditor/gram#206
Reference in a new issue
GramEditor/gram
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?