Repository navigation
fix(windows): keep the dictation on the clipboard when Windows blocks the paste, and say so in a notice - #2977
Merged
Merged
Conversation
… the paste, and say so in a notice
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.
Fixes #2975.
Problem: when
SendInputrejects Hex's Ctrl+V chord, the paste failed with "an elevated target window may reject input". @Dylanx01 found the real cause on their PC: 360 Total Security blocks Hex's simulated input, and the paste fails the same way in non-elevated Notepad and Electron windows. The failure also restored the previous clipboard, so the transcript was gone and could not be pasted by hand. The message only appeared with Labs › Failure notices on.Change:
src/windows/paste.rs: a rejected paste chord cancels the pending clipboard restore (ClipboardRestore::keep, as the shell-target fallback already does), so the transcript stays on the clipboard. The job still fails with the error tone. The error is nowcrate::paste::WINDOWS_PASTE_BLOCKED, and the sent/total counts go to atracing::warn!. The YOLO Return failure is now a short "Windows blocked Hex's Return key" with its counts in the log too.src/paste.rs: addsWINDOWS_PASTE_BLOCKED("Windows blocked Hex's paste. Your words are on the clipboard: press Ctrl+V. Security software or an app running as administrator can cause this.") andblocked_by_windows, next toPOST_EVENT_REFUSED.src/rune_ui/live_text.rs:notifies_withshows the blocked Windows paste even with Labs › Failure notices off, as it does for the macOS refused paste.src/desktop/activity.rs:failure_explanationtranslates it viadesktop::i18n::tr.failures.rs(pl, zh, ja, de, es, uk) and to the French, Russian, Hungarian and Portuguese tables. Traditional Chinese is derived from the Simplified Chinese string.docs/features/dictation.md: the Windows paste map documents the blocked-chord path and that the notice shows with Failure notices off, and names the tests that cover it.Credit to @Dylanx01 for the diagnosis: other processes could still inject input, and disabling 360 made pastes work again.
Tests: new assertions in
a_refused_paste_is_shown_with_failure_notices_off(live_text.rs) andknown_microphone_failures_get_an_actionable_explanation(activity.rs), plus a newthe_blocked_windows_paste_notice_has_every_language(i18n.rs).Not verified: this environment has no Rust toolchain, so the change has not been compiled, run through clippy, or tested, and it needs a build (ideally on Windows) before merging. Only
python3 scripts/code-shape.py --checkwas run, and it passes. Not exercised on a real Windows PC with security software.Fixes #2975