You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
摘要
Related to #1014,但不自动关闭它:#1014 当前描述的是
PreviewConfirm/Ctrl+V选区替换路径;本 PR 修复的是产生同类“完整文本嵌套重复”症状的 Windows 语音听写 TSF 路径。Windows TSF edit session 现在只把最终文本提交给宿主一次,避免 Chromium / Electron 富文本宿主在
TF_IAS_QUERYONLY预检与正式提交之间发生选区重算后,将同一全文嵌套插入两遍。复现与根因
受影响会话具备以下特征:
finalText正常且只有一份;streaming_eligible=false,且没有进入 clipboard / SendInput fallback;OpenLessEditSession::InsertText原先会把同一份全文传给宿主两次:InsertTextAtSelection(..., TF_IAS_QUERYONLY, full_text, ...)InsertTextAtSelection(..., 0, full_text, ...)按照 Microsoft TSF 合同,
TF_IAS_QUERYONLY不应修改 context;但受影响宿主会在这两次调用之间暴露或重算编辑状态,最终表现为全文嵌套重复。这里不需要预检调用:带读写 edit cookie 的正式调用本身会返回 HRESULT 和 committed range。参考:https://learn.microsoft.com/windows/win32/api/msctf/nf-msctf-itfinsertatselection-inserttextatselection
修复 / 新增 / 改进
TF_IAS_QUERYONLY预检,改为一次正式InsertTextAtSelection调用;SetSelection行为;InsertTextAtSelection,且不得重新引入全文QUERYONLY;finalText完全相等。旧的Contains断言会让嵌套重复误通过,因为内层仍包含一份完整finalText。兼容
PreviewConfirm的 Ctrl+C 校验路径、clipboard fallback、SendInput fallback、ASR/LLM 逻辑;TF_IAS_QUERYONLY直接执行读写插入,并通过ppRange返回已插入范围。测试计划
node scripts/windows-package-msvc.test.mjs2 !== 1,证明同一 edit session 存在两次宿主调用;node scripts/windows-ime-lifecycle-contract.test.mjswindows-ime-build.ps1 -Configuration Release -Platform x64windows-ime-build.ps1 -Configuration Release -Platform Win32npm testgit diff --check证据路径:
openless-all/app/windows-ime/src/edit_session.cppopenless-all/app/scripts/windows-package-msvc.test.mjsopenless-all/app/scripts/windows-real-asr-insertion-smoke.ps1