fix(tui): invite payload gets a chrome-free region so mouse-copy is exact
Mouse-selecting the invite copied the pane border: draw_share rendered the payload inside themed_block, which is Borders::ALL, so every wrapped row sat between a leading and a trailing glyph. OnionWire enables no mouse capture, so the terminal's own drag-select is the copy path and it picks up chrome. The payload now has its own region — flush at column 0, full frame width, no block, no title, no gutter on any row it occupies — with the block (title, fp, onion, copy hint) above it. Measured in cells, not chars. Also add C: OSC 52 hand the payload to the terminal clipboard (same sequence the F9 menu uses), with the key named on the screen and the mouse selection named as the fallback for terminals that block the sequence. Regression tests reconstruct the payload out of the rendered frame at 80x24, 120x40, 200x60 and 60x20 (they fail on base: the leading border column) and assert no payload row carries a border glyph.
This commit is contained in:
parent
eefa7e5cc6
commit
c3116eb19e
3 changed files with 308 additions and 13 deletions
52
docs/TUI.md
52
docs/TUI.md
|
|
@ -829,3 +829,55 @@ pane can drop the fingerprint without changing the row's meaning).
|
|||
`chars().count()`. The roster row spends its budget on the name first, then the
|
||||
`stale` word, then whatever is left on a fingerprint prefix — a 22-cell pane
|
||||
reads `bob-the-sta… stale`, not `… bbbbbbbb… stale`.
|
||||
|
||||
## Invite screen: the payload region (mouse-copy)
|
||||
|
||||
OnionWire never turns on mouse capture (`grep -rn EnableMouseCapture src/` is
|
||||
empty), so sharing an invite means the terminal's own drag-select. A drag copies
|
||||
every cell it crosses — and `draw_share` used to render the payload inside
|
||||
`themed_block("(o) invite")`, which is `Borders::ALL`: every payload row sat
|
||||
between `│` at column 0 and `│` at the last column, so the pasted string carried
|
||||
border glyphs.
|
||||
|
||||
The payload now gets its own region: **flush at column 0, full frame width, no
|
||||
block, no title, no gutter on any row it occupies**. Everything that is not the
|
||||
payload — why it exists, `fp`, `onion`, the copy key — lives in the bordered
|
||||
block *above* it. The layout is `Layout::vertical([Length(body + 2), Min(0)])`,
|
||||
so the chrome block grows with its own content and the payload always starts on
|
||||
the row after its bottom border.
|
||||
|
||||
```
|
||||
===== draw_share (real) 80x24 =====
|
||||
┌(o) invite────────────────────────────────────────────────────────────────────┐
|
||||
│give this string to a friend; they F3 paste it │
|
||||
│fp ea4a6c63… │
|
||||
│onion abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion │
|
||||
│select the link below with the mouse, or press C to copy │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
onionwire:v1:k=ea4a6c63e29c520abef5507b132ec5f9954776aebebe7b92421eea691446d22c:
|
||||
o=abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion:
|
||||
spk=0101010101010101010101010101010101010101010101010101010101010101:
|
||||
sig=46caf16b6da95e86bf93a6ee80605ec74d9e24a419c4ef802632af74f46406fae9953690e054
|
||||
01b0af934cefea617f71466f406af4bef956847200a8e915190b
|
||||
```
|
||||
|
||||
At 120x40 and 200x60 `fp` and `onion` share one row (the block is one line
|
||||
shorter); the payload region is unchanged. `wrap_invite` still breaks on `:`, so
|
||||
joining the payload rows (trailing pad cells aside) is the payload byte for byte.
|
||||
`tests/tui_chrome.rs` renders `draw_share` at 80x24, 120x40, 200x60 and 60x20 and
|
||||
asserts exactly that, and that no row carrying payload carries `│`, `|`, `┃`,
|
||||
`+`, `-` or `┄`.
|
||||
|
||||
### `C` — the explicit copy affordance
|
||||
|
||||
`C` on the invite screen writes the payload to the terminal's own clipboard with
|
||||
OSC 52 (`osc52_copy_sequence`, the same sequence the F9 menu uses for the receive
|
||||
address — no crate, no clipboard daemon, works over SSH). A terminal that does
|
||||
not implement OSC 52 ignores the sequence, so the screen names the mouse
|
||||
selection too; the line reads `select the link below with the mouse, or press C
|
||||
to copy` whenever the block is wide enough, and `press C to copy, or select the
|
||||
link below` otherwise. `?` lists the key as `F2 share invite (C copies it)`.
|
||||
|
||||
The copy has no transient confirmation of its own: `draw_share` takes only the
|
||||
payload, and `status_note` is not rendered on this screen. The mouse remains the
|
||||
path that always works.
|
||||
|
|
|
|||
Loading…
Reference in a new issue