Repository navigation
Description
Problem
On a phone, the touch key bar is the only way to send arrow keys to the program in a pane. Moving the cursor through a line in an agent's prompt or a shell takes one tap per character: holding the ← or → key sends one arrow and then nothing.
A key-bar button acts only on click (src/components/KeyBar.tsx:41-53). Its pointerdown and mousedown handlers only call preventDefault() to keep focus (KeyBar.tsx:24-30). There is no hold timer, no pointerup/pointercancel handling and no long-press action. A hardware keyboard repeats a held arrow, and the server already handles that well: #634 measured 60 held arrows at 33 ms arriving complete and in order, and keys waiting in a pane's queue are merged into one pane.send_keys (server/index.ts:2374-2389). The touch bar has no way to produce that repeat.
This is not about the input line. Key-bar arrows go to the program in the pane in both typing modes, not to the input line's textarea (src/components/PaneTerminal.tsx:1551-1567).
Proposal
Holding an arrow key on the key bar repeats it, like a held key on a keyboard.
- Tap unchanged: a tap still sends exactly one key through the existing
pressKeypath. A tap must not send two keys. - Hold: after the finger stays on an arrow for a delay (about 400 ms), the key repeats at a fixed rate (about 50 ms) until the finger lifts. The repeat uses the same path as a tap, so held Ctrl/Alt/Shift and a saved combination such as Ctrl+← apply to every repeated key, as they do to a tap.
- Stop: the repeat stops on
pointerup,pointercancel,lostpointercapture, when the button becomes disabled, when the page is hidden or the window loses focus, and when the pane or lens changes or the bar unmounts. No key is sent after the finger lifts. - Scrolling the bar: the key bar row scrolls sideways on a narrow screen. A swipe that starts on an arrow must keep scrolling the row and send no key. The browser sends
pointercancelwhen it takes over the touch for a pan, so that cancels the pending hold. - Long-press menus: a held key must not open the browser's long-press callout or context menu (
contextmenuprevented on the key,-webkit-touch-callout: none). - Which keys: the four arrows. Esc, Tab, Enter, ^C and the modifier buttons do not repeat.
- No new setting or wire change: the existing
keysWS frame and server batching carry the repeat. The rate and delay are constants.
Where
Terminal; Phone, installed app and alerts
Workarounds and alternatives
- Tap repeatedly: one tap per character. Moving 30 characters back in a prompt takes 30 taps.
- Ctrl+← / Alt+←: word jumps help in a shell, but not every agent TUI binds them, and they cannot move to a position inside a word.
Questions
- Should the customizable catalog keys that edit or scroll (Backspace, Delete, PageUp, PageDown) repeat too, or only the arrows?
- Is about 400 ms delay and 50 ms interval acceptable as fixed values, or should they follow the platform's keyboard repeat?
If the approach is acceptable, I will open a PR with a browser regression that holds a touch arrow and checks the keys frames, a tap that sends exactly one key, and a sideways swipe that sends none.
Activity
fix(terminal): no autocorrect in the input line; held Backspace and p…