Skip to content

Comments

Normalize PTY writes for PowerShell and route pastes through shared write path#1

Open
psklarkins wants to merge 1 commit intomasterfrom
codex/fix-powershell-terminal-writing-issues-with-psmux
Open

Normalize PTY writes for PowerShell and route pastes through shared write path#1
psklarkins wants to merge 1 commit intomasterfrom
codex/fix-powershell-terminal-writing-issues-with-psmux

Conversation

@psklarkins
Copy link
Owner

Motivation

  • PowerShell (pwsh/cmd) under ConPTY expects CR-driven input for Enter semantics, and sending raw LF/CRLF during paste/send causes cursor/echo corruption.
  • Paste and buffer-chooser paths were writing directly to the PTY without the platform-aware normalization, leading to inconsistent behavior in PowerShell shells.

Description

  • Added encode_text_for_pty(text: &str) and changed send_text_to_active to pre-encode outbound text and write the encoded bytes to PTYs so both single-pane writes and sync_input fanout use the same byte buffer.
  • On Windows the encoder normalizes \n and \r\n into \r to emulate typed Enter behavior for pwsh/cmd under ConPTY, while non-Windows retains the original bytes.
  • Updated the interactive buffer chooser paste path to call send_text_to_active instead of writing directly to the pane.
  • Updated paste_latest to route through send_text_to_active so paste-buffer actions benefit from the same normalization.
  • Files changed: src/input.rs, src/copy_mode.rs.

Testing

  • Ran cargo fmt which completed successfully.
  • Ran full test/compile checks in this Linux environment: cargo test / cargo check for the native build failed due to existing platform-specific issues unrelated to these changes (Windows-only mouse constants and an unrelated symbol in server.rs), so compilation could not be validated here.
  • Attempted cargo check --target x86_64-pc-windows-msvc but the Windows target toolchain is not installed in this environment so the Windows-target check could not be executed.

Note: the changes are narrowly scoped to encode and route outbound text for PTY writes; the compilation failures observed during validation are due to pre-existing cross-platform build issues in this repository and not caused by the newline normalization changes.


Codex Task

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant