Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,18 @@ impl Session {
let mut writer = pty_writer;
let mut rx = input_rx;
while let Some(data) = rx.blocking_recv() {
if writer.write_all(&data).is_err() {
// Translate LF (0x0a) → CR (0x0d) to match real keyboard
// behavior. Physical terminals send CR for Enter; the PTY
// line discipline converts CR→LF in cooked mode. TUIs in
// raw mode expect CR directly. This is safe for all modes:
// in cooked mode, ICRNL converts the CR back to LF.
let mut buf = data.to_vec();
for b in &mut buf {
if *b == b'\n' {
*b = b'\r';
}
}
if writer.write_all(&buf).is_err() {
break;
}
let _ = writer.flush();
Expand Down