diff --git a/src/bin/dosh-client.rs b/src/bin/dosh-client.rs index f37acf7..b553b6b 100644 --- a/src/bin/dosh-client.rs +++ b/src/bin/dosh-client.rs @@ -10541,14 +10541,20 @@ impl RawMode { #[cfg_attr(not(any(test, windows)), allow(dead_code))] fn windows_vt_output_mode(mode: u32) -> u32 { + const ENABLE_PROCESSED_OUTPUT: u32 = 0x0001; const ENABLE_VIRTUAL_TERMINAL_PROCESSING: u32 = 0x0004; - mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING + const DISABLE_NEWLINE_AUTO_RETURN: u32 = 0x0008; + mode | ENABLE_PROCESSED_OUTPUT + | ENABLE_VIRTUAL_TERMINAL_PROCESSING + | DISABLE_NEWLINE_AUTO_RETURN } #[cfg_attr(not(any(test, windows)), allow(dead_code))] fn windows_vt_input_mode(mode: u32) -> u32 { + const ENABLE_QUICK_EDIT_MODE: u32 = 0x0040; + const ENABLE_EXTENDED_FLAGS: u32 = 0x0080; const ENABLE_VIRTUAL_TERMINAL_INPUT: u32 = 0x0200; - mode | ENABLE_VIRTUAL_TERMINAL_INPUT + (mode | ENABLE_EXTENDED_FLAGS | ENABLE_VIRTUAL_TERMINAL_INPUT) & !ENABLE_QUICK_EDIT_MODE } #[cfg(windows)] @@ -10878,16 +10884,23 @@ mod tests { #[test] fn windows_vt_output_mode_enables_ansi_sequences() { - assert_eq!(windows_vt_output_mode(0), 0x0004); - assert_eq!(windows_vt_output_mode(0x0001), 0x0005); - assert_eq!(windows_vt_output_mode(0x0005), 0x0005); + assert_eq!(windows_vt_output_mode(0), 0x000d); + assert_eq!(windows_vt_output_mode(0x0001), 0x000d); + assert_eq!(windows_vt_output_mode(0x0005), 0x000d); + assert_eq!(windows_vt_output_mode(0x000d), 0x000d); } #[test] fn windows_vt_input_mode_enables_escape_sequence_input() { - assert_eq!(windows_vt_input_mode(0), 0x0200); - assert_eq!(windows_vt_input_mode(0x0001), 0x0201); - assert_eq!(windows_vt_input_mode(0x0201), 0x0201); + 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(0x0040), + 0x0280, + "QuickEdit must be disabled so local selection cannot freeze Dosh input" + ); + assert_eq!(windows_vt_input_mode(0x00c0), 0x0280); } #[test]