Skip to content

fix(paste): keep carriage returns raw in paste-buffer - #249

Open
xanth wants to merge 1 commit into
Helvesec:mainfrom
xanth:fix/paste-carriage-return
Open

xanth wants to merge 1 commit into
Helvesec:mainfrom
xanth:fix/paste-carriage-return

Conversation

@xanth

@xanth xanth commented Oct 26, 2026

Copy link
Copy Markdown

Closes #239

Summary

paste-buffer escaped a CR in the buffer as the two characters \r. vis(3) VIS_SAFE, which tmux uses for this escaping (cmd-paste-buffer.c), keeps CR raw, and CR is the byte that ends each pasted line. So a multi-line paste reached the program as one line with literal \r text, and nothing ran. encode_paste_byte in crates/rmux-core/src/vis.rs now returns CR unchanged, as VIS_SAFE does. This affects every platform.

Testing

Tested on: Windows 11 Pro 10.0.26300 (build 26300), with this branch on RMUX 0.10.0.

  • cargo test -p rmux-core vis: the new test safe_paste_encoding_keeps_carriage_returns encodes b"ab\rcd\r" unchanged.
  • With a shell in the pane, set-buffer with echo one\recho two\r and then paste-buffer runs both commands (the pane shows one and two), as tmux does.

Linux and macOS are covered by this PR's CI.

Cargo gates on the workspace:

  • cargo fmt --all -- --check: pass.
  • cargo clippy --workspace --all-targets -- -D warnings: pass with the pinned toolchain (1.96.1).
  • cargo build --workspace: pass.
  • cargo test --workspace --all-targets: run once on Windows with all of these fixes merged, with the same settings as the Windows CI job. 7,018 passed. 45 tests in the release and bench specs fail on this machine because Python is not on PATH (43) or the temp path is too long (2); they fail the same way without these fixes. Not run here, because they open console windows: windows_attach_exit, windows_attach_fuzz, windows_nested_mouse_issue96, windows_prompt_overlay_chain, windows_mouse_border_resize, rmux-pty's windows_conpty, and rmux-client's managed_attach_stdout_has_single_console_mode_owner.

🤖 Generated with Claude Code

paste-buffer escaped a CR in the buffer as the two characters '\r'. vis(3) VIS_SAFE, which tmux uses for this escaping, keeps CR raw, and CR is the byte that ends each pasted line, so a multi-line paste reached the program as one line with literal '\r' text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: rhys <5460583+xanth@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

paste-buffer sends each carriage return as the two characters \r

1 participant