diff options
| author | Othavio Quiliao <othavioaqa@gmail.com> | 2026-04-10 07:48:13 -0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-10 14:32:07 +0300 |
| commit | 6c62dba44e6679e37e1626f07c830c81469a0f57 (patch) | |
| tree | 48a05d4c0f88a82c5383f4ddfbb4b8b467ba5366 /src/selection.rs | |
| parent | 13fe950fe436982b5ea855e9c32ad471c618732b (diff) | |
fix: forward OSC 52 clipboard writes from pane children
herdr embeds `libghostty-vt` as a headless terminal emulator per pane,
and its readonly stream handler silently drops `.clipboard_contents`
actions. As a result, any child process that writes OSC 52 to copy to
the system clipboard (for example Amp, which enables mouse reporting
and handles selection internally) has its sequence swallowed before it
can reach the host terminal — the user sees the child's "copied" toast
but the system clipboard is never updated.
This change adds an `Osc52Forwarder` that observes raw PTY bytes in
`process_pty_bytes`, reconstructs completed `ESC ] 52 ; (c|) ; <base64>
(BEL|ST)` sequences (write/clear only — queries are dropped since herdr
has no path to reply to the child), and returns them through the
existing `ProcessBytesResult`. The reader task forwards the bytes to
the main loop via a new `AppEvent::ClipboardWrite`, which is written
to stdout from `handle_internal_event`. Routing through the main loop
keeps stdout writes serialized with `terminal.draw` and the other
existing host-terminal emitters, so the new forwarder does not race
with rendering.
Existing herdr-native selection (mouse drag in panes without mouse
reporting) is unchanged and still writes through `selection::write_osc52`.
Diffstat (limited to 'src/selection.rs')
0 files changed, 0 insertions, 0 deletions
