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

Implement REPORT_ASSOCIATED_TEXT for macOS option as alt #965

Open
peterjc opened this issue Jan 14, 2025 · 1 comment
Open

Implement REPORT_ASSOCIATED_TEXT for macOS option as alt #965

peterjc opened this issue Jan 14, 2025 · 1 comment

Comments

@peterjc
Copy link

peterjc commented Jan 14, 2025

Is your feature request related to a problem? Please describe.

Quoting https://github.com/crossterm-rs/crossterm/blob/0.28/src/event.rs#L306

        // *Note*: this is not yet supported by crossterm.
        // const REPORT_ASSOCIATED_TEXT = 0b0001_0000;

Quoting https://github.com/crossterm-rs/crossterm/blob/0.28/src/event/sys/unix/parse.rs#L283

    // *Note*: this is not yet supported by crossterm.
    // if bits & 16 != 0 {
    //     flags |= KeyboardEnhancementFlags::REPORT_ASSOCIATED_TEXT;
    // }

Describe the solution you'd like

Apple keyboards have a "option" key in place of the "Alt" key on IBM/Windows style keyboards, Apple maps "Alt" to "option" when using such external keyboards. Naturally on terminal editors, it is sometimes expected that on macOS the "option" key will behave like "alt" on Windows/Linux.

Currently most terminals on macOS offer a boolean setting controlling how the option key behaves, like Kitty's macos_option_as_alt, which gives just one mode or the other.

For example, on my layout option+3 gives "£", while option+o gives "ø". I personally use "£" quite often but don't need option+3 (aka alt+3) in my terminal. On the other hand, I rarely use "ø" but would like to map Alt+o as a shortcut for open file.

My understanding of the discussion on helix-editor/helix#7478 is if REPORT_ASSOCIATED_TEXT was implemented, on macOS the Helix editor could detect both that the user pressed option/alt and some key, and receive the often accented character that gives on macOS. This would allow context dependent interpretation.

@peterjc
Copy link
Author

peterjc commented Jan 14, 2025

Cross reference #754 which was a step in this direction, defining REPORT_ALTERNATE_KEYS.

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

No branches or pull requests

1 participant