Skip to content

fix(windows): reduce SendInput pressure after dictation#503

Merged
H-Chris233 merged 5 commits into
Open-Less:betafrom
H-Chris233:issue-491-windows-sendinput-pacing
May 20, 2026
Merged

fix(windows): reduce SendInput pressure after dictation#503
H-Chris233 merged 5 commits into
Open-Less:betafrom
H-Chris233:issue-491-windows-sendinput-pacing

Conversation

@H-Chris233
Copy link
Copy Markdown
Collaborator

@H-Chris233 H-Chris233 commented May 20, 2026

User description

Fixes #491

Summary

  • batch streaming insertion deltas before flushing to cut down excessive per-chunk Unicode SendInput pressure
  • prefer clipboard + paste shortcut when Windows TSF insertion falls back, and only retry Unicode SendInput if clipboard write fails
  • avoid reporting CopiedFallback when both clipboard write and Unicode SendInput fail
  • update settings copy to match the new Windows fallback order

Validation

  • cargo test coordinator:: --manifest-path "openless-all/app/src-tauri/Cargo.toml"

Notes

  • this change was not Windows-hardware verified in this environment; the validation here is code review plus Rust test coverage for the fallback paths

PR Type

Bug fix, Tests


Description

  • Pace Windows Unicode SendInput

  • Fallback to clipboard after failure

  • Refactor streaming insert draining

  • Add regression tests and copy updates


Diagram Walkthrough

flowchart LR
  A["Dictation streaming deltas"] -- "buffer and drain" --> B["Streaming insert flush"]
  B -- "paced Unicode SendInput" --> C["Windows text input"]
  C -- "on failure" --> D["Clipboard copy fallback"]
  D -- "user can paste manually" --> E["Recovered text"]
Loading

File Walkthrough

Relevant files
Bug fix
3 files
coordinator.rs
Add shared non-TSF fallback handling                                         
+100/-9 
dictation.rs
Extract streaming flush and add tests                                       
+126/-39
insertion.rs
Pace Windows Unicode SendInput chunks                                       
+18/-3   
Documentation
7 files
types.rs
Clarify fallback behavior in preferences docs                       
+2/-1     
en.ts
Update fallback description for paced insertion                   
+1/-1     
ja.ts
Refresh fallback wording in Japanese                                         
+1/-1     
ko.ts
Refresh fallback wording in Korean                                             
+1/-1     
zh-CN.ts
Update Chinese fallback copy                                                         
+1/-1     
zh-TW.ts
Update traditional Chinese fallback copy                                 
+1/-1     
types.ts
Align frontend preference docs with fallback flow               
+1/-1     

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

PR Reviewer Guide 🔍

(Review updated until commit 96a0ee4)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

491 - PR Code Verified

Compliant requirements:

  • Batches streaming insertion deltas before flushing.
  • Paces Windows Unicode SendInput calls.
  • Adds regression tests for the new buffering and fallback helpers.

Requires further human verification:

  • Confirm on a Windows machine that the post-dictation lag is actually gone.
  • Verify responsiveness of mouse, keyboard, VS Code, browsers, and other apps immediately after dictation ends.
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Fallback Regression

If Windows Unicode SendInput fails, the new helper only copies the dictated text to the clipboard and never issues the configured paste shortcut. In the cases this fallback is supposed to cover, the text will not appear in the active app and the user must paste manually, which is a functional regression from the previous behavior.

fn insert_via_non_tsf_fallback(
    inner: &Arc<Inner>,
    polished: &str,
    _restore_clipboard: bool,
    _paste_shortcut: PasteShortcut,
) -> InsertStatus {
    let status = finish_non_tsf_insertion_fallback(
        || inner.inserter.insert_via_unicode_keystrokes(polished),
        || inner.inserter.copy_fallback(polished),
    );

    match status {
        InsertStatus::Inserted => {
            log::warn!(
                "[windows-ime] TSF unavailable; inserted via paced Unicode SendInput fallback"
            );
        }
        InsertStatus::CopiedFallback => {
            log::warn!(
                "[windows-ime] TSF unavailable; Unicode SendInput failed, left text on clipboard"
            );
        }
        InsertStatus::PasteSent | InsertStatus::Failed => {
            log::warn!(
                "[windows-ime] TSF unavailable; Unicode SendInput fallback failed and copy fallback failed"
            );
        }
    }

    status

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit db6c4bd

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 5bf197c

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 358c8d4

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 96a0ee4

@H-Chris233 H-Chris233 merged commit e2d915e into Open-Less:beta May 20, 2026
4 checks passed
appergb pushed a commit that referenced this pull request May 20, 2026
…st 统一定位 + Windows 听写后 SendInput 降压

合并 #503(fix(windows): reduce SendInput pressure after dictation):
听写结束后降低 SendInput 调用压力,优化 coordinator/dictation/insertion 路径。

合并 #505(fix(ui): 统一 SavedToast 弹框位置与进出方向):
SavedToast 默认停靠右上角,新增 slideFrom 属性支持 right/top 两种进出方向,
SettingsModal 用 slideFrom="top" + absolute 锚定内容区。

合并 #506(refactor(ui): 精简多语言文案 + 设置/风格/市场界面与图标重构):
精简 en/ja/ko/zh-CN/zh-TW 过长功能描述文案,
风格包卡片与编辑器抽屉改用 framer-motion 进出动效,
Settings/Marketplace/shared/Icon 界面重构。

本次只动版本号,逻辑改动已在 #503 #505 #506 落盘。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[windows][bug] 录音结束后总会出现明显的约5s卡顿

1 participant