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

fix: option as meta when control and command are pressed #1096

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gaelph
Copy link

@gaelph gaelph commented Feb 2, 2025

The proposed change is to address issue #1095

It treats the Option key as Meta (or Alt) if either Command, or Control is also pressed. It also treats the Option key as Meta if the other pressed key is a special key (i.e. arrow keys).
In any other scenarios, the Option key behaviour is unchanged.

This allows for users of non-qwerty layouts (such as the azerty layout) to map Control+Alt sequences, while retaining the ability to insert characters that require the use of the option key (including, but not limited to { and [, in the case of the azerty layout).
This replicates the behaviour observed in common terminal emulators such as Kitty, WezTerm and Alacritty.

The "option as alt" settings are still honored and no change of behaviour is to be expected by users of these options.

I am not so happy with the flags.contains("C-") check in KeyUtils.isControlCode(key:, flags:) function, I’d be happy to have suggestions on how to improve that.

@qvacua qvacua assigned qvacua and unassigned qvacua Feb 4, 2025
@qvacua qvacua self-requested a review February 4, 2025 05:22
@qvacua
Copy link
Owner

qvacua commented Feb 4, 2025

Re. flags.contains("C-"): you could pass modifierFlags to isControlCode() and check contains(.control) since that's what's being checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants