Skip to content

gpui: Fix Vim jj keybinding intercepting j key from IME on macOS#52192

Merged
ConradIrwin merged 8 commits intozed-industries:mainfrom
kouphasi:fix/ime_input_macos
Mar 25, 2026
Merged

gpui: Fix Vim jj keybinding intercepting j key from IME on macOS#52192
ConradIrwin merged 8 commits intozed-industries:mainfrom
kouphasi:fix/ime_input_macos

Conversation

@kouphasi
Copy link
Copy Markdown
Contributor

@kouphasi kouphasi commented Mar 23, 2026

Fixes

close: #28174
close: #30393
close: #36610
close: #38616

(not closing related issues: #31819, #21136)

Context

There was an issue where CJK input could not be entered correctly when certain keys used during IME composition conflicted with custom keybindings while the CJK IME was enabled.

(In particular, in Vim mode, the jj keybinding in INSERT MODE could not be entered correctly.)

This issue had already been fixed on Windows, but not on macOS (and judging from the code, it is likely also present on Linux, although this has not been verified).

In this change, we aligned the behavior with Windows.

Currently, on Windows, when the CJK ( or other ) IME is enabled, IME input is prioritized.
Following this behavior, we updated macOS to also prioritize IME input.

Input source Source type ASCII-capable Result Behavior
Japanese Hiragana KeyboardInputMode false true IME handles key first
Japanese Romaji KeyboardInputMode true false Keybinding matching first
Korean KeyboardInputMode false true IME handles key first
Chinese Pinyin KeyboardInputMode false true IME handles key first
Armenian KeyboardLayout false false Keybinding matching first
Ukrainian KeyboardLayout false false Keybinding matching first
English (ABC) KeyboardLayout true false Keybinding matching first

(Since similar approaches are used in tools like Vim and Neovim, we consider this policy to be appropriate.)

Videos

before fix

before.mp4

after fix

after2.mp4

How to Review

This change modifies the gpui layer rather than Zed itself, so please verify the behavior at the gpui level, not just within Zed.

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed IME composition on macOS in Vim insert mode so multi-stroke keybindings like jj

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 23, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @kouphasi on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 23, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator bot requested review from a team, ConradIrwin and osiewicz and removed request for a team March 23, 2026 11:22
@kouphasi
Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 23, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 23, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0013f1bfa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@maxdeviant maxdeviant changed the title MacOS: Vim jj keybinding intercepts j key from IME gpui: Fix Vim jj keybinding intercepting j key from IME on macOS Mar 23, 2026
@zed-industries-bot
Copy link
Copy Markdown
Contributor

zed-industries-bot commented Mar 23, 2026

Messages
📖

This PR includes links to the following GitHub Issues: #31819, #21136
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 66ebae7

@SomeoneToIgnore SomeoneToIgnore added the area:gpui GPUI rendering framework support label Mar 23, 2026
@kouphasi
Copy link
Copy Markdown
Contributor Author

Messages
📖
This PR includes links to the following GitHub Issues: #- 21136, #- 28174, #- 30393, #- 31819, #- 36610, #- 38616 If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against c0013f1

I addressed this feedback!

@ConradIrwin
Copy link
Copy Markdown
Member

Amazing! Thanks for picking this up, it's been a much complained about bug.

@ConradIrwin
Copy link
Copy Markdown
Member

Can you please make the linter happy?

@kouphasi
Copy link
Copy Markdown
Contributor Author

@ConradIrwin

Can you please make the linter happy?

I've fixed it!

@github-actions github-actions bot added Size S and removed Size M labels Mar 25, 2026
@ConradIrwin ConradIrwin enabled auto-merge (squash) March 25, 2026 01:17
@ConradIrwin ConradIrwin merged commit ddc327f into zed-industries:main Mar 25, 2026
31 checks passed
@Songggggr
Copy link
Copy Markdown

@kouphasi I’m using the Rime input method. I can’t trigger the jj key combo when in English mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpui GPUI rendering framework support cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions Size S

Projects

None yet

5 participants