Skip to content

feat(spacing): defer grace-mode space via PHANTOM, behind a flag (#23)#86

Merged
AsafMah merged 1 commit into
devfrom
feat/spacing-phantom-grace
Jun 10, 2026
Merged

feat(spacing): defer grace-mode space via PHANTOM, behind a flag (#23)#86
AsafMah merged 1 commit into
devfrom
feat/spacing-phantom-grace

Conversation

@AsafMah

@AsafMah AsafMah commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Phase 1 of the spacing-policy epic (#14) — see docs/SPACING_POLICY.md (#85). Implements #23.

What

Unifies the two space mechanisms. The default gesture path already defers its autospace via SpaceState.PHANTOM (materialized on next input — adapts to connectors/URLs/punctuation, backspace-reversible). The two-thumb combining-grace path instead writes the space eagerly in onCombiningGraceExpired. This routes the grace commit through PHANTOM too.

New experimental, default-OFF pref PREF_SPACING_DEFER_GRACE_SPACE. When on:

  • the grace commit arms mSpaceState = PHANTOM instead of the eager insertAutomaticSpaceIfOptionsAndTextAllow + mAutospaceJustWritten + the mLastComposedWord separator patch;
  • the existing PHANTOM consumers (handleNonSeparatorEvent / handleSeparatorEvent) materialize/suppress the space on next input — so the gating (autospace-enabled, URL/email, punctuation) is applied at materialization, identical to the default path.

The downstream cursor/undo accounting already handles autospaceInserted = false, so it's unchanged.

Why default-off (and no test rewrite)

The issue's scoping note assumed an unconditional change that breaks ~8 eager grace tests. Gating behind the flag keeps the eager path as default, so those tests stay valid unchanged; I add two deferred-path tests instead. This also satisfies the roadmap's "build it behind the experimental tuning so it can be felt" guidance.

Verification

  • InputLogicTest + SettingsContainerTest115 completed, 3 failed (the AGENTS.md pre-existing baseline), 1 skipped0 new failures. New tests deferredGraceSpaceMaterializesOnNextInput and deferredGraceCommitIsBackspaceReversible pass; existing eager grace tests preserved.
  • Feel = on-device. I'm building the .dbgtest APK; toggle Two-thumb settings → "Defer grace space (experimental)" on and feel the grace-commit spacing (it should match the default swipe-path feel, with the space appearing on your next input instead of immediately). Gated on your playtest before merge — feel-critical per the spec.

Next phases: #26 (tuning panel + A11 insight) → #24 (signal-driven grace + two-gate Assisted) → #25 (adaptive cadence).

Phase 1 of the spacing-policy epic (#14). Today the default gesture path
defers its autospace via SpaceState.PHANTOM (materialized on next input,
adapts to connectors/URLs/punctuation, backspace-reversible) but the
two-thumb combining-grace path writes the space EAGERLY in
onCombiningGraceExpired. This unifies them.

New experimental, default-OFF pref PREF_SPACING_DEFER_GRACE_SPACE. When on,
the grace commit arms PHANTOM instead of the eager
insertAutomaticSpaceIfOptionsAndTextAllow + mAutospaceJustWritten + the
mLastComposedWord separator patch; the existing PHANTOM consumers
materialize/suppress the space on next input. The downstream cursor/undo
accounting already handles autospaceInserted=false, so it's unchanged.

Default-off keeps the ~8 existing eager grace tests valid (no contract
rewrite needed); adds two deferred-path tests (materialize-on-next-input,
backspace-reversible).

Verify: InputLogicTest + SettingsContainerTest -> 115 completed, 3 failed
(pre-existing baseline), 1 skipped; 0 new failures. Feel is on-device:
gated behind the flag for playtesting per the roadmap's feel-driven rule.
@AsafMah
AsafMah merged commit 2d69f91 into dev Jun 10, 2026
1 check passed
@AsafMah
AsafMah deleted the feat/spacing-phantom-grace branch June 10, 2026 23:14
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.

1 participant