mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-21 13:08:09 +00:00
Add a new `clipboard-write-limit-bytes` option (similar to `scrollback-limit-bytes`) to limit the maximum OSC 5522 write size. Defaults to 32 MB. This also adds a new `GHOSTTY_TERMINAL_OPT_CLIPBOARD_WRITE_MAX_BYTES` option for libghostty-vt embedders to control the same. Kitty has a limit too and it works by truncating all data. I decided on purpose to diverge from this because I don't think truncated binary data is useful. Instead, we reject it so the application knows the write didn't work. We truncate text data, and we try to do it at the nearest complete UTF-8 sequence (if possible). For the future: Kitty spools any write data more than some size (can't remember) to a temp file on disk. We might want to consider doing something similar since we're all in-memory at the moment. This PR doesn't change that.