fix(p2): touch selection, Copy and Paste in the web terminal

Every touch put the transparent input field under the finger, so a long press on
output selected in the empty field (Paste only) and never a word of the output;
the field's focus also opened the keyboard, whose resize redrew all rows. Rows
were replaced whenever output changed them, which dropped any selection.

Now a long press on a character of the output is Chrome's own (word, handles,
Copy); only a blank cell gets the field for Paste. Touch contextmenus are never
cancelled. While output is selected rows are not redrawn (15 s after the last
change, or until the selection ends or the user types, pastes or scrolls). Copy
joins soft-wrapped rows (new Frame row flag from libghostty) and drops the
blanks that fill rows.
This commit is contained in:
Mario Zechner 2026-11-05 11:58:59 +01:00
parent a5d209afd0
commit 1137075c78
5 changed files with 304 additions and 58 deletions

View file

@ -897,6 +897,12 @@ translated phone drawer and intercept chat taps.
Web: route-owned side sheet or resizable bottom panel, tabs, new/close/foreground-job confirmation, browser-native
selection/copy, mouse/touch scrolling, pastes, IME corrections and the remembered Ctrl/Alt/Esc/Tab/arrows/symbol key
row. Placement is remembered. The wasm, wrapper, renderer and input helper are independent copies under p2.
Touch: a long press on a character of the output is Chrome's (word selection, handles, Copy); one on a blank cell
puts the transparent textarea under the finger for Chrome's Paste (sent as a paste, bracketed when the program asks).
Touch long presses and their contextmenu are never cancelled. While output is selected, rows are not redrawn (15 s
after the selection last changed, or until it ends, the user types, pastes or scrolls), since redrawing a row drops
a selection in it. Copy joins soft-wrapped rows and drops the blanks that fill rows. `terminal-clipboard.test.ts`
covers this as far as CDP can (headless Chromium has no long-press gesture, selection handles or native menus).
SSH configuration comes from the envs plugin and the conversation's location environment; the separate `terminal-sessions.json`
mapping is no longer read. Host keys use `ssh/known_hosts` and `pi-env-<name>` aliases. `envs.test.ts` exercises a
remote terminal against a disposable localhost SSH fixture; no real remote host is used. Windows PTYs remain unsupported. The workspace has an owner-only