Skip to content

fix(input): handle panelless direct commits reliably - #1171

Open
Tsingv wants to merge 2 commits into
rime:masterfrom
Tsingv:master
Open

fix(input): handle panelless direct commits reliably#1171
Tsingv wants to merge 2 commits into
rime:masterfrom
Tsingv:master

Conversation

@Tsingv

@Tsingv Tsingv commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • defer panelless direct commits to the next main-runloop turn for the VS Code integrated terminal
  • track and clear synthetic marked text so clients such as Alacritty do not consume the first unhandled key after punctuation
  • preserve normal synchronous commits when a real preedit is active
  • configure the workarounds only for the known affected applications

Motivation

This is a follow-up to #1165.

VS Code's integrated terminal (xterm.js) can drop insertText when a panelless commit, such as full-width punctuation, is delivered synchronously during keyDown. Alacritty, on the other hand, needs the synthetic marked-text phase but may retain it after insertText, causing the first Backspace to cancel composition instead of deleting text.

The two behaviors are therefore kept independently configurable:

  • force_marked_text_for_direct_commit synthesizes the marked-text phase
  • defer_direct_commit moves the final insertion to the next main-runloop turn

Default 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_options to the known affected clients: Alacritty and VS Code.

Testing

  • tested Chinese input and full-width punctuation in Alacritty
  • verified that the first Backspace after a direct punctuation commit is no longer swallowed
  • tested Chinese input and full-width punctuation in the VS Code integrated terminal
  • retested Microsoft Word, including the previously observed font-fallback case
  • built the Debug target with CODE_SIGNING_ALLOWED=NO (BUILD SUCCEEDED)

Tsingv added 2 commits August 11, 2026 22:36
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.
@lotem

lotem commented Aug 12, 2026

Copy link
Copy Markdown
Member

我反對針對客戶程序的BUG做特殊處理。
軟件邏輯不考慮兼容輸入法,那就不要爲了強行兼容,在輸入法代碼裏加入難以理解、難以維護的補丁。

@lotem

lotem commented Aug 14, 2026

Copy link
Copy Markdown
Member

比起 #1172 還是這個實現可靠一些。
我再看看……

@lotem lotem reopened this Aug 14, 2026

@lotem lotem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

兩個 commit 分開看,能接受……
可是這類補丁打多了,代碼難免成麪條。

爲解 BUG 可以先收着。
@LEOYoon-Tsaw 有意見沒?

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.

2 participants