Repository navigation
fix(terminal): no autocorrect in the input line; held Backspace and paging keys repeat - #965
Merged
Merged
Conversation
The terminal input line set only autoCapitalize="off", so iOS autocorrect could replace a non-dictionary token (a flag, path or branch name) on Space and the rewritten command was sent. The composer and the queue editor already turn both off; the input line now matches them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The key bar's hold-to-repeat covered only the four arrows, so holding the key-bar Backspace deleted one character and clearing a line took one tap per character. The editing and paging keys now repeat like the arrows; Escape, Tab, Enter, ^C and the function keys still send once. Refs #862 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
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 |
The hold paragraph still said only arrows repeat. Backspace, Delete, Home, End, PageUp and PageDown repeat too now; Esc, Tab, Enter, ^C, F-keys and modifiers send once. Also widen the description of key-bar-hold-repeat-regression.ts, which now holds Backspace as well. Co-Authored-By: Claude Opus 5.5 <[email protected]>
devswha
added a commit
that referenced
this pull request
Oct 18, 2026
…1325) ## Summary Holding the iOS keyboard's ⌫ in a terminal pane (direct typing) deleted one character and stopped (#862). Root cause, isolated in the iOS 27.0 simulator with plain textareas: the iOS keyboard repeats a held ⌫ only while the focused field **has text**, and not at all when the field has **`white-space: nowrap`**. Cancelling the keydown (as xterm does), opacity 0, a tiny size, z-index under the canvas or an opaque element over the field made no difference. xterm's helper textarea fails both conditions: typed keys are sent on keydown and cancelled (so nothing lands in it), xterm empties it after Backspace/Enter/^C/blur, and xterm.css gives it `nowrap`. Fix (iPhone and iPad only, `src/lib/deleteRepeat.ts` + `PaneTerminal.tsx`): keep one space in an otherwise empty helper textarea, refilled from capturing `focus`/`keydown`/`input` listeners registered after xterm's own (a bubbling listener never runs: xterm stops propagation in the capture phase at the target), and set the textarea to `pre-wrap`. xterm still sends each ⌫ as DEL and cancels its edit, so the space is never deleted and never reaches the pane; compositions start after it (`compositionstart` uses the field's length), and a field that already holds text is never touched. Design reference: this is a WebKit input-field workaround, not a pattern copied from another app. Native iOS terminals (Blink, Termius, a-Shell) implement `UIKeyInput` themselves, so the question does not arise for them; stock xterm.js in iOS Safari has the same defect. ## Verification - iOS 27.0 simulator (iPhone 18 Pro), Safari, on-screen keyboard driven with AXe touch down/up, owned raw-mode PTY capture in an isolated herdr test session: - 3 s hold of ⌫: **1 DEL before, 24 DELs after** (English keyboard); Korean keyboard after the fix: 18 DELs in 2 s. - Typed text, Space, double Space and Enter reach the PTY unchanged (`h i ␠ ␠ z \r`), no stray space. - Korean typing is unchanged by this PR (see below). - The input line was already fine (a plain field: a held ⌫ empties it locally). - `scripts/key-bar-hold-repeat-regression.ts` gains two steps: outside iOS the helper textarea stays empty and `nowrap`; under an iPhone user agent it keeps one space before the caret and `pre-wrap` through Backspace, typing and Enter, and only the typed keys (`DEL DEL DEL a b \r`) reach the pane. Fails on main, passes here. Chromium cannot repeat an iOS key, so the repeat itself was measured only in the simulator. - `scripts/terminal-ipad-ime-regression.ts` (the #938 iPad hardware-keyboard Hangul replay) passes unchanged, and also with `maxTouchPoints` forced to 5 so the space is active (run ad hoc, not committed). - `src/lib/deleteRepeat.test.ts`; `bun run check fast` passes. ## Limits / please review - Measured only in the iOS 27.0 simulator; the reporter used Chrome on iOS 27 (same WebKit, the CriOS user agent hits the same branch). Chrome for iOS could not be installed in the simulator. - The iPad **hardware-keyboard** Hangul path is covered by the recorded replay only: with `pre-wrap`, text the editor leaves in the one-cell-wide field wraps instead of overflowing; I did not exercise that on a real iPad. - The issue's "(or any key)": on the iOS soft keyboard only ⌫ auto-repeats; the key bar's keys repeat since #965. - Separate finding, not changed here: on main, the iPhone soft Korean keyboard in direct typing sends each jamo separately (`ㅎㅏㄴㄱㅡㄹ` for 한글). iOS sends keydown key=jamo keyCode 0, then deleteContentBackward + insertText with no composition events; the #938 replacement path in the xterm patch is gated to iPad/Mac Safari, so iPhone is excluded. A plain textarea composes 한글 correctly. Worth its own issue. Fixes #862 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two small touch-input papercuts in the terminal lens:
Cause
src/components/TerminalInput.tsx: the textarea sets onlyautoCapitalize="off"; noautoCorrect="off", nospellCheck={false}. Its doc comment even listed autocorrect as a rewrite the line exists to absorb.src/lib/keyRepeat.ts:isRepeatableKeyBarItemreturns true only forArrowUp/Down/Left/Right.KeyBarwires press-and-hold only for repeatable items, so every other key is a plain click. (Terminal: holding a key-bar arrow repeats it, like a held key on a keyboard #718 left "should Backspace, Delete, PageUp, PageDown repeat too?" as an open question; feat(terminal): cursor style, held key-bar arrows and pinch-to-zoom #758 shipped arrows only.)Fix
Two commits:
TerminalInputtextarea getsautoCorrect="off"andspellCheck={false}, matchingComposer.tsxand the queue editor. The doc comment now says autocorrect stays off and why.isRepeatableKeyBarItemuses a set: the arrows plus Backspace, Delete, Home, End, PageUp, PageDown, with or without saved modifiers (like the arrows). Escape, Tab, BackTab, Enter, Insert, ^C/^D/^Z, F-keys, printable keys and modifier buttons stay single-shot: a repeated Tab or ^C would act many times on what one press meant. Delay and rate are unchanged (400 ms / 50 ms).Tests
src/lib/keyRepeat.test.ts: the positive case now covers the six editing/paging keys (bare and with saved modifiers); the negative case keeps Escape, Tab, BackTab, Enter, Insert, ctrl-c, ctrl-d, F1, printable keys and modifiers. Fails without the fix (1 fail), passes with it.scripts/key-bar-hold-repeat-regression.ts: new step 5b holds the key-bar ⌫ and checks it repeats (the DEL byte on the input path, 11 sends in the run) and sends nothing after release. Without the fix the step fails ("got 1").bun run check run bun scripts/key-bar-hold-repeat-regression.ts: all steps pass.scripts/terminal-input-regression.ts(run insideui-regression.ts): asserts the input line hasautocorrect="off",spellcheck="false",autocapitalize="off".bun run check run --build bun scripts/ui-regression.ts: pass (exit 0), including "PASS terminal input".bun run typecheck: pass.bun run test:unit: 3069 pass, 0 fail (including the test: enforce AGENTS.md conventions with repo-wide guard tests #949 conventions guard; the new post-release wait carries a// fixed wait:note).autocorrect="off", as the composer already does.Notes
DEFAULT_KEY_BAR_ITEMSis unchanged: ⌫ is still opt-in through key-bar customization. Neither When holding down backspace on mobile, the key does not repeat in terminal mode #862 nor the docs ask for it in the default bar, and changing defaults touches settings migration and telemetry customization flags.Composer.tsx/PaneTerminal.tsx/compose.tsonly; no file overlap. Its body says "the terminal input line keeps its current attributes"; after this PR those attributes are off, matching the composer default. I suggest its toggle should not cover the terminal line, since shell tokens are the worst case for autocorrect.KeyBar.tsxbut not the repeat logic orkeyRepeat.ts; this PR does not editKeyBar.tsx.changelog.d/terminal-input-autocorrect-and-key-repeat.md(two Fixed entries).Merge-session review
Fixed (3468ec3):
docs/terminal-input.mdstill said only the arrows repeat when held. It now lists the arrows, ⌫, Del, Home, End, PgUp and PgDn (saved combinations of these repeat too) and says Esc, Tab, Enter, ^C, F-keys and modifier buttons send once.docs/development.mdnow describeskey-bar-hold-repeat-regression.tsas covering holds of arrows and editing keys.Docs only, so there is no new regression test;
src/lib/keyRepeat.test.tsand browser step 5b already pin the behavior.bun run check fastpasses. The changelog fragment was already accurate.Deferred: none.
🤖 Generated with Claude Code