Skip to content

Add an opt-in per-character delay to type - #166

Merged
bitomule merged 1 commit into
mainfrom
worktree-t-mav-153-type-delay
Dec 3, 2026
Merged

bitomule merged 1 commit into
mainfrom
worktree-t-mav-153-type-delay

Conversation

@bitomule

@bitomule bitomule commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Fixes #153.

What

type gets an opt-in pause between characters, for fields that fetch suggestions on every keystroke and drop characters when the whole text arrives in one burst.

  • CLI: mav ui type "Kitchen table" --delay-per-char 100ms (also --delay-per-char=100ms)
  • Flow: - type: { text: "Kitchen table", delayPerChar: 100ms }

Accepted values: 100ms, 0.1s, or a bare number of milliseconds (same spellings flows already use for durations).

How

AXe's type has no delay option, so mav does it: with a delay set, each character is its own driver call and mav pauses between two characters (not before the first or after the last, so a one-character text costs nothing). The element selector only goes with the first character, since it is what focuses the field. Without the flag nothing changes: the text is still one driver call.

  • A value that is unreadable, negative or over 5s per character is rejected (type_delay_invalid) before anything is typed, rather than silently ignored.
  • In a flow, a bad delayPerChar (or one on a non-type step) fails when the flow loads.
  • With --stdin, --file or --spec, the flag is refused rather than ignored.
  • A failure part-way reports how many bytes were sent (chars_sent); the pause stops on context cancellation.
  • Kept local: a new type_delay.go, plus small hooks in uiType, the flow type step, the flow payload struct, the usage text/golden, README and skill docs.

Tests

New type_delay_test.go: duration parsing, flag splitting, the per-character loop (order of calls and pauses, selector only on the first character, partial failure, cancellation), uiType through the real AXe driver with a fake runner (one axe type per character with the flag; one call without; invalid values and --stdin refused), and flow parse/validation.

Ablation: with the delayed branch in uiType disabled, TestUITypeDelayPerCharTypesEachCharacterSeparately fails (axe type calls = [Table]); restored, it passes. make test is green on the rebased tree.

Not verified against a live simulator and a suggestion-as-you-type field; the behaviour is covered by the driver-level tests above.

@bitomule
bitomule force-pushed the worktree-t-mav-153-type-delay branch from c29a08a to a394649 Compare December 2, 2026 23:49
@bitomule
bitomule force-pushed the worktree-t-mav-153-type-delay branch 2 times, most recently from efd2cad to f09e8d0 Compare December 3, 2026 10:02
@bitomule
bitomule force-pushed the worktree-t-mav-153-type-delay branch from f09e8d0 to 917c1c8 Compare December 3, 2026 10:25
A field that fetches suggestions on every keystroke can drop characters
when the whole text arrives in one burst. `mav ui type TEXT
--delay-per-char 100ms` and the flow param `delayPerChar` send one
character per driver call with a pause between them. Without the option
the text is still typed in a single call.

An unreadable, negative or over-5s value is rejected before anything is
typed, and a flow with a bad `delayPerChar` fails when it loads.

Fixes #153
@bitomule
bitomule force-pushed the worktree-t-mav-153-type-delay branch from 917c1c8 to dcf8847 Compare December 3, 2026 11:00
@bitomule
bitomule merged commit 85ec78c into main Dec 3, 2026
1 check passed
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.

type has no per-character delay, and fast typing drops characters in fields with live suggestions

1 participant