Skip to content

Keep set-buffer text exact and read it from stdin - #14836

Merged
teamleaderleo merged 2 commits into
manaflow-ai:mainfrom
teamleaderleo:fix/set-buffer-stdin-exact
Sep 26, 2026
Merged

teamleaderleo merged 2 commits into
manaflow-ai:mainfrom
teamleaderleo:fix/set-buffer-stdin-exact

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

cmux set-buffer trimmed whitespace and newlines from its text, so a buffer could never end in a newline or keep leading indentation, and it had no way to take piped input. Moving output from one pane to another meant copying it through the macOS clipboard.

set-buffer now stores the text exactly as given, like tmux, and reads stdin when there is no text argument or the argument is a lone -. With a terminal on stdin and no text it still fails with "set-buffer requires text" instead of waiting for EOF.

cmux read-screen --surface surface:1 --lines 40 | cmux set-buffer --name out
cmux paste-buffer --name out --surface surface:2

Whitespace-only text is now accepted (tmux accepts it too); only empty text is rejected. paste-buffer itself is unchanged.

Testing

  • cmuxCLITests/CLITmuxCompatBufferContentTests.swift runs the bundled CLI against a scratch HOME and checks the stored buffer for: piped stdin with indentation and a trailing blank line, -, an argument with leading spaces and a trailing newline, and empty stdin (fails, nothing written).
  • Commit d72fcfa adds the tests alone; three of the four fail against main's behavior (the empty-stdin guard passes on both). Commit f2d114f is the fix.
  • Local: scripts/verify-local.py project, test-wiring, localization and Swift syntax checks passed. I did not build or run the tests locally; they run in CI.
  • Localization: one new error string (cli.setBuffer.error.invalidUTF8), translated for all nine macOS locales; localization_catalog.py check reports 0 parity errors. The changed set-buffer help text is one of the existing unlocalized tmux-compat help blocks.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

set-buffer now stores text exactly as given, like tmux, instead of trimming whitespace and newlines, and reads from stdin when no text argument (or -) is passed.

  • Piped output can now be moved between panes intact via cmd | cmux set-buffer then paste-buffer.
  • Whitespace-only text is accepted; only empty text is rejected.
  • With a terminal on stdin and no text, it fails with "set-buffer requires text" instead of waiting for EOF.
  • Adds CLITmuxCompatBufferContentTests covering piped stdin, -, argument preservation, and empty stdin.

Written for commit f2d114f. Summary will update on new commits.

Review in cubic

teamleaderleo and others added 2 commits September 26, 2026 10:12
These fail on main: set-buffer trims leading and trailing whitespace and
newlines from its argument, and with no argument it errors instead of
reading stdin (a lone `-` is stored literally).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
set-buffer trimmed whitespace and newlines from its text, so a buffer
could never end in a newline or keep leading indentation, and it had no
way to take piped input. It now stores the text exactly as given, like
tmux, and reads stdin when no text argument (or a lone `-`) is passed,
so `cmd | cmux set-buffer` followed by `cmux paste-buffer` moves output
between panes intact.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 2c259a30-5ac8-4c2b-87fc-d5ebaa8a3542

📥 Commits

Reviewing files that changed from the base of the PR and between 9bae42b and f2d114f.

📒 Files selected for processing (6)
  • CLI/CMUXCLI+TaskHelp.swift
  • CLI/cmux.swift
  • Resources/Localizable.xcstrings
  • cmux.xcodeproj/project.pbxproj
  • cmuxCLITests/CLITmuxCompatBufferContentTests.swift
  • docs/cli-contract.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@teamleaderleo
teamleaderleo merged commit a4e4aa4 into manaflow-ai:main Sep 26, 2026
63 of 64 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for f2d114fbb0: every check was green at merge (16 verified; 15 skipped by policy). Full suite runs on main after merge.

rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 26, 2026
413ece1 CI tooling, guard and test hardening (manaflow-ai#14864)
a4e4aa4 Keep set-buffer text exact and read it from stdin (manaflow-ai#14836)
83ed511 Tighten welcome, cmux-cua build, and codex wrapper follow-ups (manaflow-ai#14857)
8c9d2c9 perf: keep the durable event log open across flushes (manaflow-ai#14829)
6d876f9 Send the PTY paste test's Cmd+V to a first-responder terminal (manaflow-ai#14825)
f190c87 Re-supply user-declared external agent launchers on resume (manaflow-ai#10503)
d522606 web: render changelog features as patch notes cards (manaflow-ai#14869)
b5d0bff Stop other bundles and scripts from killing the running cmux (manaflow-ai#14831)

# Conflicts:
#	.github/workflows/ci-main-full-suite.yml
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.

1 participant