diff --git a/src/voicetype.swift b/src/voicetype.swift index a7fd2d1..791700d 100644 --- a/src/voicetype.swift +++ b/src/voicetype.swift @@ -812,6 +812,13 @@ Thread.detachNewThread { var role = focusedTextRole(pid: pid) if role == nil { nudgeAX(pid); usleep(250_000) + // 250ms 阻塞期间用户可能已松手;再查 buttonState, + // 已松开 → 立刻 .dead,不把"已结束的点击"升级成录音 + if !CGEventSource.buttonState(.combinedSessionState, button: .left) { + state.v = .dead + DispatchQueue.global().async { Engine.current.cancel() } + break // 跳出 switch 的 .press 分支,回到 polling 顶 + } role = focusedTextRole(pid: pid) } func startRec() {