diff --git a/src/pty/client.rs b/src/pty/client.rs index 20b1ce0..268b9d1 100644 --- a/src/pty/client.rs +++ b/src/pty/client.rs @@ -151,7 +151,7 @@ mod tests { #[test] fn send_data_buffers_when_socket_would_block() -> Result<()> { - let (mut writer, mut reader) = UnixStream::pair()?; + let (writer, mut reader) = UnixStream::pair()?; writer.set_nonblocking(true)?; let mut client = ClientInfo::new(writer); diff --git a/src/pty/terminal.rs b/src/pty/terminal.rs index 8a882af..37fcfbb 100644 --- a/src/pty/terminal.rs +++ b/src/pty/terminal.rs @@ -153,10 +153,17 @@ pub fn send_refresh(stream: &mut impl Write) -> io::Result<()> { /// Send terminal refresh sequences to restore normal state pub fn send_terminal_refresh_sequences(stream: &mut impl Write) -> io::Result<()> { - // Send minimal refresh sequences without modifying cursor + // Send refresh sequences to restore standard terminal state after TUIs let refresh_sequences = [ - "\x1b[m", // Reset all attributes - "\x0c", // Form feed (clear screen) + "\x1b[m", // Reset all attributes + "\x1b[?25h", // Ensure cursor is visible + "\x1b[?7h", // Enable auto-wrap + "\x1b[?1000l", // Disable mouse tracking + "\x1b[?1002l", // Disable cell motion mouse tracking + "\x1b[?1003l", // Disable all motion mouse tracking + "\x1b[?2004l", // Disable bracketed paste + "\x1b[0;0r", // Reset scroll region + "\x0c", // Clear screen ] .join("");