Uh oh!
There was an error while loading. Please reload this page.
fix(tui): omit NUL characters in clipboard writes - #44959
Conversation
Host clipboards reject NUL characters, so /copy failed entirely when a transcript contained a NUL byte from shell output (anomalyco#44198). Strip NULs in the clipboard adapter so the copy succeeds without them.
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found two related PRs that appear to address the same issue:
Both of these PRs are tackling the same problem as PR #44959 (your current PR): removing NUL characters from clipboard writes in the TUI to fix the clipboard paste issue. These are likely duplicate attempts to fix the same underlying issue (#44198). |
fQwQf
commented
Aug 25, 2026
Closing as duplicate of #44197, which implements the same fix and was opened earlier. Verified the approach works on GNOME Terminal / Wayland with the native host clipboard backend. |
Issue for this PR
Closes#44198
Type of change
What does this PR do?
Shell tool output often contains NUL bytes, and the host clipboard rejects text containing NUL characters, so
/copyfailed entirely with "Failed to copy session transcript".This strips NUL characters in the clipboard adapter (
packages/tui/src/clipboard.ts) before the text reaches OpenTUI, so one stray byte no longer fails the whole copy — the rest of the transcript is copied as-is, which is the behavior requested in the issue.How did you verify your code works?
Added a regression test in
packages/tui/test/clipboard.test.ts: writing"a\0b\0"through the adapter now passes"ab"to the clipboard service.tsc/typecheck and oxlint pass.Reviewer repro:
Before: error toast, clipboard unchanged. After: copy succeeds, pasted text
is
abc.Screenshots / recordings
N/A
Checklist