Skip to content

macOS: per-pane independent keyboard input source (IME) support#12439

Open
zc911 wants to merge 1 commit into
warpdotdev:masterfrom
zc911:per-pane-input-source
Open

macOS: per-pane independent keyboard input source (IME) support#12439
zc911 wants to merge 1 commit into
warpdotdev:masterfrom
zc911:per-pane-input-source

Conversation

@zc911

@zc911 zc911 commented Jun 10, 2026

Copy link
Copy Markdown

Summary

When switching focus between split panes on macOS, each pane now remembers and restores its own keyboard input source (IME). This eliminates the need to manually toggle input methods when working in bilingual/multilingual workflows across panes.

For example: English input (ABC) in the left pane for terminal commands, Chinese Pinyin in the right pane for documentation — each pane keeps its own IME state independently.

Closes #12316

Changes

  • keycode.m — Added get_current_input_source_id() and select_input_source() with [NSThread isMainThread] guards
  • window.rs — FFI declarations + Rust wrapper methods on Window
  • focus_state.rsHashMap<PaneId, String> to store per-pane input source state, with save/restore on focus change

Design decisions

  • All pane types supported — Terminal, Agent, Editor, Notebook share the same PaneId-based mechanism
  • New panes inherit current input source on first focus
  • [NSThread isMainThread] guard prevents Carbon TIS API crashes on background threads
  • macOS-only via #[cfg(target_os = "macos")]
  • No feature flag needed — the behavior is passive (memory-only) and no-ops gracefully

Testing

  • cargo check -p warp — passes
  • cargo test -p warp -- "pane_group::" — 106 passed, 0 failed (parallel)
  • Manual verification: split panes, different IME per pane, focus switching restores correctly

🤖 Generated with Claude Code

@cla-bot

cla-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: chenzhen48.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jun 10, 2026
@oz-for-oss

oz-for-oss Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@zc911

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #12316, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@zc911

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #12316, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

When switching focus between split panes, each pane now remembers and
restores its own macOS keyboard input source (e.g., English ABC in one
pane, Chinese Pinyin in another).

- Adds get_current_input_source_id() and select_input_source() to the
  macOS ObjC keycode bridge, with [NSThread isMainThread] guards to
  ensure Carbon TIS APIs are only called from the main thread.
- Exposes these as Window::get_current_input_source_id() and
  Window::select_input_source() in the Rust FFI layer.
- PaneGroupFocusState stores a HashMap<PaneId, String> mapping each
  pane to its last known input source ID. On focus change, it saves
  the departing pane's source and restores the incoming pane's source.
- New panes inherit the current system input source on first focus.
- Feature is macOS-only via #[cfg(target_os = "macos")].

Closes warpdotdev#12316
@zc911 zc911 force-pushed the per-pane-input-source branch from c4d9647 to ebf66e4 Compare June 10, 2026 06:39
@cla-bot

cla-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @zc911 on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@zc911

zc911 commented Jun 10, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jun 10, 2026
@cla-bot

cla-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

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

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

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Per-Pane Independent Input Method (IME) Support

1 participant