diff --git a/src/terminal/sys/unix.rs b/src/terminal/sys/unix.rs index 7129730a..d72a3d7f 100644 --- a/src/terminal/sys/unix.rs +++ b/src/terminal/sys/unix.rs @@ -216,13 +216,16 @@ fn read_supports_keyboard_enhancement_raw() -> io::Result { // See // ESC [ ? u Query progressive keyboard enhancement flags (kitty protocol). - // ESC [ c Query primary device attributes. - const QUERY: &[u8] = b"\x1B[?u\x1B[c"; - - let result = File::open("/dev/tty").and_then(|mut file| { - file.write_all(QUERY)?; - file.flush() - }); + // ESC [ 0 c Query primary device attributes. + const QUERY: &[u8] = b"\x1B[?u\x1B[0c"; + + let result = File::options() + .write(true) + .open("/dev/tty") + .and_then(|mut file| { + file.write_all(QUERY)?; + file.flush() + }); if result.is_err() { let mut stdout = io::stdout(); stdout.write_all(QUERY)?;