Skip to content

Add IME input support for mpv chat via mp.input API - #757

Open
hex110 wants to merge 1 commit into
Syncplay:masterfrom
hex110:fix/mpv-ime-input
Open

Add IME input support for mpv chat via mp.input API#757
hex110 wants to merge 1 commit into
Syncplay:masterfrom
hex110:fix/mpv-ime-input

Conversation

@hex110

@hex110 hex110 commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Uses mpv's native mp.input.get() text input API (mpv 0.39+) for chat, which properly supports IME composition for Chinese, Japanese, Korean and other input methods
  • Falls back to existing key-binding system for older mpv versions — no behavior change for users on mpv < 0.39
  • Enables --input-ime=yes in mpv launch args (mpv defaults to no on Windows)

Closes #732

Use mpv's native mp.input.get() text input (available in mpv 0.39+) which
properly supports IME composition for Chinese, Japanese, Korean and other
input methods. Falls back to existing key-binding system for older mpv.

Also enables --input-ime=yes in mpv launch args (mpv defaults to no on
Windows) so IME is active when text input is opened.

Closes Syncplay#732

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cangming99 added a commit to cangming99/syncplay that referenced this pull request Sep 11, 2026
Merge the best of both implementations of Syncplay#732 (mpv chat IME input):
keep the load-time capability detection and the unmodified mpv launch args
from the local variant, and take the prompt handling, the shared send path and
the native-input state from Syncplay#757.

Taken from Syncplay#757:
- open_native_input(): prompt from the inputPromptStartCharacter option
  (the '>' character was hardcoded before), and a using_native_input flag that
  is reset from both the submit and closed callbacks
- send_chat_line(): single chat send path, with a nil/empty guard, reused by
  the legacy REPL branch
- show_and_type() also routes to the native input box so the "chat" action no
  longer opens the legacy REPL in parallel

Deliberately not taken from Syncplay#757:
- the module-level mp.input indexing, which breaks the whole script on
  mpv < 0.38; detection stays a pcall() with a set_active(true) fallback
- 'input-ime': 'yes' in MPV_ARGS: the option only exists in mpv 0.40+, and
  mpv's builtin console (which mp.input.get() opens) enables IME on demand
  and restores the previous value, so forcing it globally keeps IME active
  during playback, which mpv documents as breaking key bindings

Refs: Syncplay#757
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.

Add Chinese input support for mpv chat

3 participants