Skip to content

fix(tui): drop NUL characters before clipboard writes - #44230

Open
aniruddhaadak80 wants to merge 1 commit into
anomalyco:devfrom
aniruddhaadak80:clipboard-nul-chars
Open

fix(tui): drop NUL characters before clipboard writes#44230
aniruddhaadak80 wants to merge 1 commit into
anomalyco:devfrom
aniruddhaadak80:clipboard-nul-chars

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

Issue for this PR

Closes #44198

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Shell output can contain NUL characters, and clipboard backends reject text that contains them (e.g. spawn refuses argv with NUL bytes on macOS), so /copy fails and the clipboard is left unchanged. This drops NUL characters from the text in write() before it reaches any backend (OSC52 included), matching the behavior requested in the issue.

How did you verify your code works?

  • Added a unit test for withoutNul covering NUL-containing and clean input (bun test test/clipboard.test.ts in packages/tui, all pass).
  • Ran bun run typecheck in packages/tui successfully.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate found:

The current PR (#44230) and PR #44197 both target the TUI clipboard functionality and likely address overlapping concerns. You may want to review PR #44197 to ensure there's no duplication of work.

@aniruddhaadak80

Copy link
Copy Markdown
Author

The unit test and typecheck workflows are in action_required state - could a maintainer approve the workflow runs for this first-time contribution? Local verification: packages/tui tests pass and typecheck is clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: /copy fails when transcript contains NUL characters

1 participant