Repository navigation
feat(mobile): add terminal keyboard autocomplete toggle - #5348
Conversation
# Conflicts: # package.json
Terminal command inputs disable autocorrect/suggestions and use a password-class keyboard so the OS never rewrites commands, flags, or paths. Some users want phone-style typing in the command bar. Add a Settings → Terminal "Autocomplete & autocorrect" toggle (persisted locally, default off). When on, the command bar enables autoCorrect/spellCheck and uses the default keyboard so Android shows its suggestion strip; iOS drops the ascii-capable restriction. The direct keyboard-capture input is unchanged — it streams raw keystrokes where suggestions cannot apply. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new terminal keyboard autocomplete/autocorrect preference is added across four files. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b2cf4a1b-b560-400a-999c-869c7cb6de87
📒 Files selected for processing (3)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/app/terminal-settings.tsxmobile/src/storage/preferences.ts
Android caches the IME inputType at mount, so flipping the toggle did not switch suggestions on until the field remounted.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
2310-2314:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd cleanup to prevent state updates after unfocus.
The
useFocusEffectcallback can resolve after the screen unfocuses or unmounts, causing a React warning whensetAutocompleteEnabledruns on an unmounted component. Add a cleanup function with anactiveflag to skip the state update if the effect has been torn down, matching the pattern used at lines 2038-2050.♻️ Suggested fix
useFocusEffect( useCallback(() => { - void loadTerminalAutocompleteEnabled().then(setAutocompleteEnabled) + let active = true + void loadTerminalAutocompleteEnabled().then((enabled) => { + if (active) { + setAutocompleteEnabled(enabled) + } + }) + return () => { + active = false + } }, []) )
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0fdcb239-8459-4495-b728-1fb98aa2d7b6
📒 Files selected for processing (1)
mobile/app/h/[hostId]/session/[worktreeId].tsx
…oggle Address review feedback: the settings toggle's initial load could clobber a fast user toggle, and the session focus-effect could setState after the screen unfocused. Both now use a guard flag.
|
Addressed the review feedback in b6dc2bf:
|
Co-authored-by: Orca <[email protected]>
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks — this is a good default-off mobile preference for users who want normal phone typing in the terminal command bar without changing the raw/live terminal input path.
I made one small maintainer follow-up:
- added storage preference tests for default-off, load/save, and read-failure behavior
- limited the forced command-input remount to Android, where the IME caches keyboard type; iOS can update without that focus-costly remount
Validated:
- mobile: oxlint
- mobile: tsc --noEmit
- mobile: Vitest full suite, 67 files / 326 passed / 2 skipped
Live device verification was handled separately before merge.
* release: v1.4.48-rc.0 [rc-slot:2026-06-05-15] * release: v0.0.1-rc.0 [rc-slot:2026-06-06-03] * feat(mobile): add terminal keyboard autocomplete toggle Terminal command inputs disable autocorrect/suggestions and use a password-class keyboard so the OS never rewrites commands, flags, or paths. Some users want phone-style typing in the command bar. Add a Settings → Terminal "Autocomplete & autocorrect" toggle (persisted locally, default off). When on, the command bar enables autoCorrect/spellCheck and uses the default keyboard so Android shows its suggestion strip; iOS drops the ascii-capable restriction. The direct keyboard-capture input is unchanged — it streams raw keystrokes where suggestions cannot apply. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(mobile): remount command input when autocomplete toggles Android caches the IME inputType at mount, so flipping the toggle did not switch suggestions on until the field remounted. * fix(mobile): guard autocomplete pref loads against unmount and fast toggle Address review feedback: the settings toggle's initial load could clobber a fast user toggle, and the session focus-effect could setState after the screen unfocused. Both now use a guard flag. * test mobile terminal autocomplete preference Co-authored-by: Orca <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Jinwoo-H <[email protected]> Co-authored-by: Orca <[email protected]>
Summary
Adds a Settings → Terminal → "Autocomplete & autocorrect" toggle that lets users opt into phone-style keyboard autocomplete/autocorrect for the terminal command bar.
The terminal command input deliberately disables
autoCorrect/spellCheckand uses a password-class keyboard (visible-passwordon Android,ascii-capableon iOS) so the OS never rewrites commands, flags, or paths. That's the right default, but some users want normal phone typing with suggestions — this makes it a per-device preference (orca:terminalAutocompleteEnabled, default off) instead of hardcoded behavior.autoCorrect/spellCheckand switches to thedefaultkeyboard (Android suggestion strip appears; iOS drops the ascii-capable restriction). On Android theTextInputis remounted on toggle because the IME inputType is cached at mount.Screenshots
Visual change is limited to: (1) a new "Autocomplete & autocorrect" Switch row under a "KEYBOARD INPUT" group in Terminal settings, and (2) when enabled, the OS suggestion strip over the terminal command bar. No other UI changes. Verified visually on an Android device (see Testing).
Testing
pnpm lint(oxlintclean inmobile/)pnpm typecheck(tsc --noEmitclean inmobile/)pnpm test(vitestsuite passes inmobile/)pnpm build(release APK built)TextInputprops/AsyncStorage; behavior was verified on-device. The storage helpers are thin AsyncStorage get/set.On-device (Android): toggle off → no suggestions (unchanged); toggle on → suggestion strip appears in the command bar; direct-capture input stays raw either way.
AI Review Report
Reviewed with Claude Code. Main risks checked:
loadTerminalAutocompleteEnabled()could clobber a fast user toggle. Fixed inb6dc2bfwith auserToggledAutocompleteRefguard plus astaleflag, and the session focus-effect now guardssetStatewith anactiveflag so it can't fire after unfocus/unmount.keyboardType(ascii-capableon iOS,visible-passwordon Android,defaultwhen enabled), gated onPlatform.OS.Security Audit
Low risk. The change persists a single boolean to local
AsyncStorageand togglesTextInputprops. No command execution, path handling, auth, secrets, network, or IPC surface is involved. Enabling autocomplete routes typed text through the OS IME/suggestion engine (standard for any text field); the raw direct-capture PTY path is unchanged. No new dependencies.Notes
TextInputis remounted (via akeychange) on toggle because Android caches the IME inputType at mount; without the remount, suggestions wouldn't switch on/off until the field was recreated.🤖 Generated with Claude Code