ovis icon indicating copy to clipboard operation
ovis copied to clipboard

Terminal (phone): a touch cannot select or copy terminal text

Open NicoLeo13 opened this issue 1 week ago • 1 comments

What happened

  1. Open a pane in the Terminal view on a phone (390 px, touch).
  2. Long-press a line and drag across it, or swipe across it.
  3. Nothing is selected, and no Copy action exists in the terminal view.

Expected: select terminal text by touch and copy it, the way every mobile terminal does (long press starts a selection; release or a Copy action puts it on the clipboard).

How often

Every time

Ovis version

0.5.9 (b87b57b2)

How it runs

herdr plugin

Server PC

Fedora Linux 44 x86_64, herdr 0.9.5

Device and browser

Reproduced in headless Chromium with mobile emulation (390x844, hasTouch, Android UA) against the same server; not yet on a physical phone. The maintainer's own Android-app checks in #3327 show the app takes the pty when it attaches, which is the same drive case measured below.

How the device reaches the server

This PC (localhost), for the reproduction

How it signs in

Nothing (this PC), role drive

Agent and PC

opencode pane w3:p18, local PC

What I measured

In the Terminal view at 390x844, driving the pane (the phone sizes the pty):

Check Value
.pane-terminal computed touch-action none
.xterm computed user-select none
.xterm-screen width 367 px (fits the screen: not folded)
.terminal-fold-row count 0
After a 700 ms press + 120 px drag, window.getSelection().isCollapsed true
After the same drag, .xterm-selection div count 0

A plain one-finger drag scrolls the pane (wheel reports to herdr), as designed.

Why

  • src/components/PaneTerminal.css:45-52: .pane-terminal has touch-action: none, so a browser selection gesture never starts there (the comment says the drag is the app's, turned into wheel events).
  • xterm's own stylesheet sets user-select: none on .xterm (node_modules/@xterm/xterm/css/xterm.css:38-44).
  • src/lib/useTerminalMount.ts:691-694: the drag that selects starts on mousedown and returns at once for a touch (sourceCapabilities.firesTouchEvents).
  • src/lib/useTerminalMount.ts:1999-2027: a one-finger touchmove is preventDefaulted and becomes wheel reports, never an xterm selection.
  • The copy path the mouse uses reports a selectionQuote only from that mouse drag (src/lib/useTerminalMount.ts:825,853), and Quote in message is drawn from it (src/components/PaneTerminal.tsx:1076-1090).
  • The pane menu (src/components/PaneCanvas.tsx:281-296) offers Search conversation, the layout actions, Original width / Wrap to screen, Recover unsent text, Unlock agent and Close pane. No Select or Copy.

The one selectable terminal text today is the folded wrap view: .terminal-fold sets user-select: text (src/components/PaneTerminal.css:76-90) and is drawn when this device does not size the pty (foreign() at src/lib/useTerminalMount.ts:445). A phone that drives the pane sizes it (367 px above), so there is no fold, and the grid has no touch selection. #3327 describes the fold for a watch device.

What would fix it

  1. On (pointer: coarse), a long press starts a selection: one-finger movement extends it through xterm's selection API, and release copies it when herdr's copy_on_select is on, else a Copy action appears (the key bar, or a small button over the pane), matching "Drag to select and it is copied on release".
  2. At minimum, a pane-menu Select all / Copy text that puts the visible terminal text on the clipboard, as the Chat view already copies each answer.

Related: #3327 (the fold on a wide grid), #3476 (selection over cell backgrounds).

NicoLeo13 avatar Nov 25 '26 11:11 NicoLeo13

Still reproducible in 0.5.11 (the release running here) and unchanged in 0.5.12.

  • Phone emulation, 390x844, touch, 750 ms press + 100 px drag: no selection, no quote banner, no clipboard write.
  • Desktop/web, 1280x800, mouse with Shift held: selection appears, the quote banner shows and the text reaches the clipboard. So the gap is touch-only, not a broken copy path.
  • v0.5.12 does not change these paths: .pane-terminal still has touch-action: none, the selection drag still returns for touches (sourceCapabilities.firesTouchEvents at src/lib/useTerminalMount.ts:682), and its only touch change is a TOUCH_STROKE_CLAIMED handoff for the mobile drawer. Release note 'copy rows cleanly' is about copied row text, not touch selection.

Environment for the check: Fedora Linux 44 x86_64, herdr plugin, herdr 0.9.5, local server at 127.0.0.1:7317.

NicoLeo13 avatar Nov 27 '26 12:11 NicoLeo13