fix(input): handle panelless direct commits reliably - #1171
Open
Tsingv wants to merge 2 commits into
Open
Conversation
VS Code's integrated terminal (xterm.js) drops insertText delivered synchronously inside keyDown for panelless direct commits such as full-width punctuation. Add defer_direct_commit so those inserts run on the next main-runloop turn. Keep the marked-text workaround independently configurable and apply deferral only when preedit is empty, so normal Chinese confirmation remains synchronous.
Some clients retain the synthetic marked range after insertText, causing the next unhandled key, notably Backspace, to cancel composition instead of reaching the application. Track synthetic marked text and clear it on the next main-runloop turn or before passing through an unhandled key. Preserve the marker across empty context refreshes and keep normal Rime updates for unhandled keys.
Member
|
我反對針對客戶程序的BUG做特殊處理。 |
Member
|
比起 #1172 還是這個實現可靠一些。 |
lotem
approved these changes
Aug 14, 2026
lotem
left a comment
Member
There was a problem hiding this comment.
兩個 commit 分開看,能接受……
可是這類補丁打多了,代碼難免成麪條。
爲解 BUG 可以先收着。
@LEOYoon-Tsaw 有意見沒?
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
Motivation
This is a follow-up to #1165.
VS Code's integrated terminal (xterm.js) can drop
insertTextwhen a panelless commit, such as full-width punctuation, is delivered synchronously duringkeyDown. Alacritty, on the other hand, needs the synthetic marked-text phase but may retain it afterinsertText, causing the first Backspace to cancel composition instead of deleting text.The two behaviors are therefore kept independently configurable:
force_marked_text_for_direct_commitsynthesizes the marked-text phasedefer_direct_commitmoves the final insertion to the next main-runloop turnDefault behavior
As discussed in #1165, I also tested enabling the marked-text workaround globally. The earlier implementation caused font fallback in Microsoft Word. The cleanup in this PR has fixed that issue in current testing, but broader testing is still in progress.
For now, this PR does not make the workaround global. It remains scoped through
app_optionsto the known affected clients: Alacritty and VS Code.Testing
CODE_SIGNING_ALLOWED=NO(BUILD SUCCEEDED)