Voice: show dictated transcript in the Quick Add field

The mic captured speech and the transcript reached rawText, but it never appeared
in the field. NLTaskField.updateUIView (UITextView representable) returned early
when the field wasn't focused (`guard coordinator.isEditing`), so externally-set
text (voice dictation, the normal not-focused case) was dropped and the
placeholder stayed.

Fix: render non-empty `text` even when not editing, placing the caret at the end;
keep the cursor-preserving fast path while actively editing. No new voice system —
this only fixes the existing mic button's transcript→field binding.

Verified on simulator via the real speech.transcript path: "Buy milk tomorrow" →
field shows it (chip: Tomorrow); "Call Romeo at 11 AM" → field shows it (chip:
Today 11:00). Adds DEBUG-only test hooks KISANI_AUTOADD / KISANI_VOICE_SIM
(compiled out of Release). Logged under KC-38.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kutesir
2026-06-24 21:22:45 +03:00
parent f8d0a80f17
commit ad304913e4
3 changed files with 53 additions and 3 deletions

View File

@@ -161,6 +161,15 @@ struct ContentView: View {
.presentationDetents([.height(150)])
.presentationDragIndicator(.visible)
}
#if DEBUG
.onAppear {
// Test hook: auto-open Quick Add (used to verify the voicefield binding
// on the simulator, which has no microphone). Compiled out of Release.
if ProcessInfo.processInfo.environment["KISANI_AUTOADD"] == "1" {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { showQuickAddTask = true }
}
}
#endif
.onChange(of: showWorkoutTab) { _ in ShortcutHandler.registerShortcuts() }
}