Repository navigation
iOS: insert a dictation only into the field it was made in (#346) - #375
Merged
Merged
Conversation
A result was addressed to a keyboard process only, so a keyboard over a
different field in the same process — the user tapped field B while the
words for field A were still being transcribed, with iOS keeping the
controller or bringing up a new one — inserted them there.
The press and stop commands now carry the field's
UITextDocumentProxy.documentIdentifier beside the controllerID they
already sent; the coordinator keeps a ResultAddress (process, controller,
document) for the press and for the accepted stop, and the relay puts it
on the DictationResult. A keyboard inserts only when the result names its
controller and document; otherwise it leaves the result, and the app
copies the words out at its delivery timeout ("Copied"), as when no
keyboard takes them. A part left nil by an older build matches anything.
Fixes #346
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
alexkroman
enabled auto-merge
November 24, 2026 22:58
3 tasks
alexkroman
pushed a commit
that referenced
this pull request
Nov 25, 2026
…eld-read test #375 gave the relay a ResultAddress presser; the injected clock now sits beside it, and the delivered test steps the clock while asserting the controller. #370 independently moved the held-read test onto a TestClock with its own press helper; its version is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #346.
Problem
DictationResultwas addressed to a keyboard process only. If the user released in field A and then tapped field B before "Pasted", a keyboard over B in the same process inserted A's words. That covers both cases: iOS often keeps the same input controller across fields in one app, or a new controller comes up in the same process.appeared()→resultArrived()hit the same hole.Fix
KeyboardCommandnow carriesdocumentID(UITextDocumentProxy.documentIdentifier) beside thecontrollerIDit already sent.controllerIDalone wouldn't catch the main repro, since iOS can reuse one controller as focus moves between fields; the document identifier is what changes.ResultAddress(process + controller + document). The coordinator keeps one for the press and one for the accepted stop (stop wins, asrecipientdid). The relay puts it onDictationResult.resultArrived()inserts only whenresult.isFor(controllerID:documentID:). Otherwise it leaves the result in the store (not taken), so the owner can still take it, and the app copies the words out at its delivery timeout with "Copied", the existing fallback when no keyboard takes them.nilby an older build matches anything, so a mixed-version app/keyboard behaves as before.Tests
appeared()path), is not inserted and stays in the store. Back over the right field, it inserts.documentIdentifier.Worth a hardware check
The behavior assumes
documentIdentifieris stable for one field across a dictation (press → result). If some host app changed it mid-dictation, the outcome would be "Copied" instead of "Pasted", never words in the wrong field.🤖 Generated with Claude Code