diff --git a/src/bin/dosh-client.rs b/src/bin/dosh-client.rs index 87ace7a..3e01fd8 100644 --- a/src/bin/dosh-client.rs +++ b/src/bin/dosh-client.rs @@ -10552,10 +10552,23 @@ fn windows_vt_output_mode(mode: u32) -> u32 { #[cfg_attr(not(any(test, windows)), allow(dead_code))] fn windows_vt_input_mode(mode: u32) -> u32 { + const ENABLE_PROCESSED_INPUT: u32 = 0x0001; + const ENABLE_LINE_INPUT: u32 = 0x0002; + const ENABLE_ECHO_INPUT: u32 = 0x0004; + const ENABLE_WINDOW_INPUT: u32 = 0x0008; + const ENABLE_MOUSE_INPUT: u32 = 0x0010; + const ENABLE_INSERT_MODE: u32 = 0x0020; const ENABLE_QUICK_EDIT_MODE: u32 = 0x0040; const ENABLE_EXTENDED_FLAGS: u32 = 0x0080; const ENABLE_VIRTUAL_TERMINAL_INPUT: u32 = 0x0200; - (mode | ENABLE_EXTENDED_FLAGS | ENABLE_VIRTUAL_TERMINAL_INPUT) & !ENABLE_QUICK_EDIT_MODE + (mode | ENABLE_EXTENDED_FLAGS | ENABLE_VIRTUAL_TERMINAL_INPUT) + & !(ENABLE_PROCESSED_INPUT + | ENABLE_LINE_INPUT + | ENABLE_ECHO_INPUT + | ENABLE_WINDOW_INPUT + | ENABLE_MOUSE_INPUT + | ENABLE_INSERT_MODE + | ENABLE_QUICK_EDIT_MODE) } #[cfg(windows)] @@ -10894,13 +10907,22 @@ mod tests { #[test] fn windows_vt_input_mode_enables_escape_sequence_input() { assert_eq!(windows_vt_input_mode(0), 0x0280); - assert_eq!(windows_vt_input_mode(0x0001), 0x0281); - assert_eq!(windows_vt_input_mode(0x0201), 0x0281); + assert_eq!( + windows_vt_input_mode(0x0001), + 0x0280, + "Ctrl-C and other control bytes must pass through to the remote terminal" + ); + assert_eq!(windows_vt_input_mode(0x0201), 0x0280); assert_eq!( windows_vt_input_mode(0x0040), 0x0280, "QuickEdit must be disabled so local selection cannot freeze Dosh input" ); + assert_eq!( + windows_vt_input_mode(0x007f), + 0x0280, + "line, echo, local mouse, insert, and window input modes must stay off" + ); assert_eq!(windows_vt_input_mode(0x00c0), 0x0280); }