feat: emit osc 52 for pane copies - #42
Merged
Merged
Conversation
Manager pane copies now write the OSC 52 clipboard sequence to the pane terminal in addition to the native clipboard writer, so Herdr 0.9.0 forwards the copy to the viewing client when the plugin runs on a remote server. When only the terminal copy lands, the manager stays open and reports it instead of hiding the native failure. The global copy-context and copy-archive actions run with piped stdout and no terminal, so they are unchanged. The parity harness now retains the raw PTY stream and compares the emitted sequences and their payloads in both runtimes. refs #40
A remote server commonly has no clipboard tool at all, so the native write fails on every copy there. Reporting that as a failure defeated the case the change is for: the OSC 52 copy had already reached the person's clipboard, and copy-and-archive returned before its archive step, so Shift+C never archived. Either destination landing is now a successful copy, in both runtimes. Only a copy that reached neither carries the native error, which a pane with a live terminal cannot produce. Manager copy failure is therefore unreachable, so the copy-failure steps are gone from the all-views parity case and three osc52-remote-* cases replace them, asserting that Shift+C still writes its archive and clears the active list when only the terminal copy landed. refs #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pane copies now also emit OSC 52, so a copy made inside a pane reaches the clipboard of the machine the person is sitting at when the plugin runs on a remote Herdr server (Herdr 0.9.0 forwards OSC 52 from pane output to the viewing client).
What changed
src/pane-clipboard.tsandrust/src/pane_clipboard.rs: the OSC 52 encoder (ESC ] 52 ; c ; <base64> BELover the raw UTF-8 bytes) and a wrapper that runs the native clipboard write first, then emits the sequence to the pane's terminal. Byte-identical across both runtimes, with byte-exact tests including empty and multi-byte text. Oversized payloads are emitted whole, never truncated.y,candShift+Ccopies in both runtimes go through the wrapper. Semantics: a copy that reached either destination is a success, so on a server without a clipboard tool, copies and copy-and-archive still work through the client's terminal. A copy that reached neither fails with the native error, as before.store.manager.osc52-remote-copy*cases run with the native writer failing, including an absolute assertion thatShift+Carchives (3 sets, 0 active). A negative control (no-op emitter) produces 14 divergences, so the checks are not vacuous.Not covered here: the global actions
copy-contextandcopy-archiverun with piped stdout and no terminal, so they cannot use OSC 52; that needs a Herdr plugin clipboard API (to be raised upstream).Validation
bun test80 pass;bunx tsc --noEmitclean;cargo fmt/clippy/testinrust/clean, 64 + 4 passbash scripts/parity-lite.sh: 510 observables, 94 screens, zero divergences / 1 deliberatepbcopy:yandShift+Cfrom the manager each delivered one OSC 52 sequence carrying the full Markdown to the client's terminal, the local native clipboard stayed untouched, andShift+Carchived the set and cleared the active list.refs #40