Skip to content

fix(windows): 修复剪贴板 sentinel 竞争导致划词追问与划词编辑无法抓取选区 (#1024) - #1025

Open
HKLHaoBin wants to merge 9 commits into
Open-Less:betafrom
HKLHaoBin:fix/selection-voice-capsule-autohide
Open

fix(windows): 修复剪贴板 sentinel 竞争导致划词追问与划词编辑无法抓取选区 (#1024)#1025
HKLHaoBin wants to merge 9 commits into
Open-Less:betafrom
HKLHaoBin:fix/selection-voice-capsule-autohide

Conversation

@HKLHaoBin

Copy link
Copy Markdown
Contributor

摘要

Fixes #1024

修复 Windows 选区抓取:写入 sentinel / 恢复剪贴板时与剪贴板历史抢锁,导致模拟 Ctrl+C 静默失败,划词追问和划词编辑被误判为无选区。

修复 / 新增 / 改进

  • Windows 模拟复制改为以剪贴板内容变化为准,而不是只认 sentinel 字符串。
  • sentinel 写入后等待剪贴板 settle,必要时重发 Ctrl+C,避开 Clipboard History 占用。
  • 选区捕获失败原因写入可导出日志,区分「真没选区」和「复制未覆盖剪贴板」。
  • 划词语音 begin 失败(无选区)时胶囊按听写口径约 2 秒自动收回。
  • windows crate 启用 Win32_System_DataExchange,正确处理 GetOpenClipboardWindow

兼容

  • 不包含:版本号 bump、release/MSI workflow 调整、非 Windows 选区策略改动。
  • 对现有用户 / 本地环境 / 构建流程的影响:仅影响 Windows 选区抓取路径;macOS AX 直读不受影响;无需迁移配置。

测试计划

  • 命令:在 Windows 记事本选中文字 → 划词追问快捷键 → 应打开提问面板且日志无 selectionVoiceNoSelection
  • 结果:Chrome 中同样操作,开启系统剪贴板历史后仍能抓到选区
  • 证据路径:导出 openless.log,确认 [selection] / [selection-voice]reason= 诊断行
  • 无选区时胶囊约 2 秒自动收回
  • cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib(能在本机跑的部分)

HKLHaoBin and others added 9 commits September 2, 2026 08:11
…ction

Schedule the standard 2s capsule idle timer after no-selection begin errors so the Siri-style prompt does not stay on screen indefinitely.

Co-authored-by: Cursor <cursoragent@cursor.com>
Distinguish clipboard sentinel unchanged, empty copy, shortcut failure, and prefetch vs live capture so user-exported logs can diagnose false no-selection reports.

Co-authored-by: Cursor <cursoragent@cursor.com>
Format optional front_app in prefetch miss logs and gate the NoCapturePath fallback to non-desktop targets so macOS/Windows/Linux builds compile cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>
…e capture

Co-authored-by: Cursor <cursoragent@cursor.com>
…Ctrl+C validation

Co-authored-by: Cursor <cursoragent@cursor.com>
Clipboard History async listeners can hold the clipboard after we write the
sentinel, so target-app Ctrl+C silently fails. Wait for settle, poll, and
optionally resend Ctrl+C. Bump to 1.3.18-Beta.10.

Co-authored-by: Cursor <cursoragent@cursor.com>
Bare `as u64 <` is parsed as a generic; cfg(windows) code still must parse on Linux CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
windows 0.58 returns Result<HWND>; annotate VIRTUAL_KEY for GetAsyncKeyState.

Co-authored-by: Cursor <cursoragent@cursor.com>
上游 PR 只保留选区捕获 / 剪贴板 sentinel 修复。版本号仍由上游发布流程管理。

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

[windows] 剪贴板恢复/sentinel 导致划词追问与划词编辑无法抓到选区

1 participant