Repository navigation
fix(dictate): keep what the user copied, and never read another window's text after a dictation - #525
Merged
Conversation
After a dictation the helper reads the field again when the target loses the keyboard. Windows read whatever element had focus at that moment, and macOS read the app's focused element, so after moving to another window the new window's field was read and could leave the helper as an edit hunk. Both backends now read only while the target's window still has the keyboard, and answer unreadable otherwise.
On Windows a clipboard another program held open through the snapshot's retries read as empty, so the paste kept the dictation as a lasting copy and what the user had copied was lost once that program let go. The snapshot now reports a clipboard it could not read, and the insert fails clipboard-busy before it publishes, leaving the clipboard untouched.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…ow the user moved to The DC-L2 unit test checks only the predicate; nothing failed if a backend's read_field stopped calling it. The real-desktop step now watches a second paste, raises another window of the same process, and expects edit.unreadable with reason unreadable (reason lost without the check).
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.
Problem
Two things in the dictation helper could take data the user did not mean to give.
dictation.editand offered it to the learner.Fix
unreadable. On macOS, a move to another app still reads the original field, as before.clipboard-busybefore it publishes, so the clipboard is not touched. The app already opens the draft box when an insert fails.Testing
dc_l2_a_read_goes_only_to_the_window_the_insert_went_into(readback.rs): this checks the window rule that both backends call. A rule that always allows the read fails it with "another window of the app".dc_n6_a_clipboard_too_busy_to_read_is_never_replaced(insert.rs): when the clipboard is busy during the snapshot, no key is posted, and the old text and image are still there after 9 s. It fails when a busy clipboard is treated as empty: the insert comes backInserted { method: "paste" }. The existing empty-clipboard test is the positive control.cargo fmt --check,cargo clippy -D warnings(with and withoutsimulate) andcargo testpass on macOS with the pinned toolchain.bun run check:staticpasses. The Windows code does not compile on macOS. The Windows helper job in CI is the check for it.