Add IME input support for mpv chat via mp.input API - #757
Open
hex110 wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mp.input.get()text input API (mpv 0.39+) for chat, which properly supports IME composition for Chinese, Japanese, Korean and other input methods--input-ime=yesin mpv launch args (mpv defaults tonoon Windows)Closes #732