Answer a clipboard read with any clipboard types and listing #24

Closed
opened 2026-10-16 15:11:16 -05:00 by jeff · 1 comment
Owner

Part of #23

A kitty clipboard read (OSC 5522) is answered with one piece of text. harrier's ClipboardAnswer is denied | text, and Session.answerClipboardRead serves that text under each text type the program asked for, reporting available as text/plain, hardcoded.

The Ghostty fork already takes more. clipboard.Read.Result.success carries contents, a list of (type, bytes), and a caller-supplied available. encodeReadReply serves each requested type its own DATA packets, and a type with no entry gets none, which the protocol reads as "not available". So this needs no fork change and no pin bump.

What done looks like

  • ClipboardAnswer carries the contents read, as (Clipboard type, bytes) pairs, and the types the clipboard has, for the listing. Session.answerClipboardRead hands both to the fork.
  • A requested text type is served from whichever text type was read, so text read under one name answers a request for another.
  • Today's callers build the answer from the text they have, so behavior is unchanged until #25 and #26.
  • Session unit tests cover a multi-type answer, a requested type that wasn't read, and a listing other than text/plain.
Part of #23 A kitty clipboard read (OSC 5522) is answered with one piece of text. harrier's `ClipboardAnswer` is `denied | text`, and `Session.answerClipboardRead` serves that text under each text type the program asked for, reporting `available` as `text/plain`, hardcoded. The Ghostty fork already takes more. `clipboard.Read.Result.success` carries `contents`, a list of (type, bytes), and a caller-supplied `available`. `encodeReadReply` serves each requested type its own DATA packets, and a type with no entry gets none, which the protocol reads as "not available". So this needs no fork change and no pin bump. ## What done looks like - `ClipboardAnswer` carries the contents read, as (Clipboard type, bytes) pairs, and the types the clipboard has, for the listing. `Session.answerClipboardRead` hands both to the fork. - A requested text type is served from whichever text type was read, so text read under one name answers a request for another. - Today's callers build the answer from the text they have, so behavior is unchanged until #25 and #26. - Session unit tests cover a multi-type answer, a requested type that wasn't read, and a listing other than `text/plain`.
jeff changed title from Answer a kitty clipboard read with any clipboard type, in the Ghostty fork to Answer a clipboard read with any clipboard types and listing 2026-10-16 15:15:00 -05:00
jeff self-assigned this 2026-10-16 15:15:04 -05:00
jeff closed this issue 2026-10-16 15:18:42 -05:00
Author
Owner

Done in 59714c2. ClipboardAnswer is denied | contents{read, available}. clipboardResult serves each requested type its own bytes, serves a text type from text read under any name, and passes available through. No Ghostty fork change was needed. The window still answers with text/plain alone, until #25 and #26.

Done in 59714c2. `ClipboardAnswer` is `denied | contents{read, available}`. `clipboardResult` serves each requested type its own bytes, serves a text type from text read under any name, and passes `available` through. No Ghostty fork change was needed. The window still answers with `text/plain` alone, until #25 and #26.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
jeff/harrier#24
No description provided.