feat(windows): 新增「始终使用 SendInput」开关,跳过听写时的 TSF 切换#734
Open
HKLHaoBin wants to merge 5 commits into
Open
Conversation
Add windowsSendInputInsertionOnly so users who cannot restore their IME after dictation can opt into Unicode SendInput without switching to OpenLess TSF at session start. Open-Less#733 Co-authored-by: Cursor <cursoragent@cursor.com>
Serde camelCase produced windowsSendinputInsertionOnly while the UI sends windowsSendInputInsertionOnly, causing the toggle to revert after save. Add explicit rename/alias on UserPreferences wire types and contract tests. Refs Open-Less#733 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
PR Reviewer Guide 🔍(Review updated until commit 1498c51)Here are some key observations to aid the review process:
|
Contributor
Author
• 引入 WindowsInsertionMode 枚举,用于管理文本插入策略(TSF、SendInput、粘贴)。 • 添加 WindowsSendInputNewlineMode 枚举,用于指定 SendInput 中的换行符处理方式。 • 更新 TextInserter,以支持 Windows 的新插入方法和选项。 • 重构 Unicode 按键处理,以适应换行符模拟模式。 • 增强用户偏好设置,包含新的插入模式及其各自的默认值。 • 更新 UI 组件,允许用户选择首选的插入方法和换行处理方式。 • 改进了英文、日文、韩文、简体中文和繁体中文新设置的本地化。 • 添加了测试以验证新功能,并确保文本插入符合预期行为。
Contributor
|
Persistent review updated to latest commit 9cac724 |
Contributor
|
Persistent review updated to latest commit 2318266 |
Contributor
|
Persistent review updated to latest commit 1498c51 |
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.

User description
摘要
Fixes #733
新增 Windows 专用 opt-in 开关「始终使用 SendInput(不切换输入法)」。开启后听写 session 不再调用
prepare_session()切换 OpenLess TSF,全程使用 SendInput Unicode 插入。同时修复设置开关保存后立刻回落的问题(serde JSON key 与前端不一致)。修复 / 新增 / 改进
windowsSendInputInsertionOnly/windows_sendinput_insertion_only(默认 false)begin_session条件跳过windows_ime.prepare_session();插入走insert_via_non_tsf_fallbackwindowsSendinputInsertionOnly导致前端 key 被忽略、开关保存回落dictation_error_code单元测试兼容
alias兼容旧错误 key 写入的preferences.json测试计划
npm run build --prefix openless-all/app;CI workflow_dispatch(run 27925685545)全绿cargo test windows_sendinput --lib(Windows CI job 通过)openless-windows-x64preferences.json含"windowsSendInputInsertionOnly": true);听写开始/结束任务栏输入法不变PR Type
Enhancement, Bug fix
Description
Add Windows insertion mode (TSF/SendInput/Paste) and newline simulation options
Skip TSF IME switching when SendInput mode active, fixing IME restoration issues
Fix serde JSON key alignment so the toggle doesn't revert after save
Update UI and i18n for new settings across 5 languages
Diagram Walkthrough
flowchart LR begin["Begin Session"] --> modeCheck{"Windows Insertion Mode"} modeCheck -- "Tsf" --> prepareTsf["Prepare OpenLess IME (TSF)"] modeCheck -- "SendInput" --> skipPrepare["Skip prepare_session()"] modeCheck -- "Paste" --> skipPrepare endSession["End Session"] --> modeCheck2{"Windows Insertion Mode"} modeCheck2 -- "Tsf" --> tsfPath["Insert via TSF IME (existing)"] modeCheck2 -- "SendInput" --> sendinputPath["Insert via SendInput Unicode (skip IME)"] modeCheck2 -- "Paste" --> pastePath["Insert via Ctrl+V / clipboard paste"]File Walkthrough
3 files
Add Tauri stubs for Windows test harnessAdd default windows insertion mode to mock dataAdd new fields to test preferences fixture7 files
Route insert via mode; add sendinput optionsSkip TSF prepare when SendInput mode; update streamingAdapt insert_via_unicode_keystrokes signature with optionsAdd WindowsInsertionMode, WindowsSendInputNewlineMode enumsAdd SendInput options, newline and tab supportAdd WindowsInsertionMode and WindowsSendInputNewlineMode typesAdd selection controls for insertion mode and newline mode5 files
Add English labels for new Windows insertion settingsAdd Japanese labels for new Windows insertion settingsAdd Korean labels for new Windows insertion settingsAdd Chinese simplified labels for new settingsAdd Chinese traditional labels for new settings