Skip to content

feat(ios): delete right after a dictation takes all of it back - #256

Merged
alexkroman merged 1 commit into
AssemblyAI:mainfrom
dylan-duan-aai:feat/ios-delete-last-dictation
Oct 21, 2026
Merged

alexkroman merged 1 commit into
AssemblyAI:mainfrom
dylan-duan-aai:feat/ios-delete-last-dictation

Conversation

@dylan-duan-aai

Copy link
Copy Markdown
Contributor

Why

Dictations land as whole sentences, so clearing a bad one meant holding delete through it a character at a time (the keyboard's delete doesn't repeat yet).

What

  • resultArrived() remembers exactly what it inserted, separator included (lastInsertion).
  • deleteBackward() removes all of it in one tap when the text before the caret still ends with it and nothing is selected.
  • Any keystroke into the host clears it, so only the first delete is the big one. A moved caret, a selection, or a host whose documentContextBeforeInput is shorter than the dictation falls back to a one-character delete.
  • Applies to both the panel and full-keyboard delete keys (both call model.deleteBackward()).

Testing

  • New test deleteTakesBackDictation in ProtocolTests covers: whole dictation removed once then single characters, typing after a dictation, moved caret, and selection.
  • scripts/ios-test.sh: 145 passed, 0 failed; BlurtiOSCore line coverage 97.19% (gate 88%).
  • scripts/ios-typecheck.sh: ok.
  • Not yet tried by hand on a device.

🤖 Generated with Claude Code

Dictations land as whole sentences, so clearing a bad one meant holding
delete through it a character at a time. The keyboard now remembers what
the last result inserted (separator included); the next delete removes
all of it, provided the caret still sits at its end with nothing
highlighted. Any keystroke, a moved caret, a selection, or a host that
shows less context than the dictation falls back to a one-character
delete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman merged commit 79a4f59 into AssemblyAI:main Oct 21, 2026
12 checks passed
@alexkroman alexkroman mentioned this pull request Oct 30, 2026
alexkroman pushed a commit that referenced this pull request Nov 11, 2026
…er (#297)

* feat(ios): add a setting to make delete after a dictation one character

Delete right after a dictation takes all of it back (#256). A new
"Delete whole dictation" toggle in Settings > Keyboard turns that off,
so delete removes one character like any other. On by default, so
existing behavior is unchanged; stored in the App Group like the other
keyboard settings and read on each delete.

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(ios): move KeyboardLayout into its own file

SharedState.swift was exactly at SwiftLint's 400-line file_length limit;
the deleteWholeDictation key and accessor took it to 412, which
`swiftlint lint --strict` fails on. KeyboardLayout is independent of the
App Group contract, so it moves out verbatim, beside MicAlignment.swift
and VoiceElementKind.swift (and matching the keyboard's
KeyboardLayout+Height.swift). No behaviour change.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants