From db360f8b002039b3b54108a1432b724b0bff9c20 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Wed, 25 Nov 2026 17:14:15 +0000 Subject: [PATCH] Suppress Kitty graphics replies on every pet image chunk (#63992) The first chunk of a Kitty pet image upload already requests quiet mode, but continuation chunks omit that setting. Send `q=2` on every continuation chunk, including the final one, to suppress terminal replies throughout the upload. ## Testing Extend the command snapshot test to check the headers of a three-chunk upload, including the final `m=0,q=2` header. GitOrigin-RevId: cd12c3e6f4c27320c4823f593657ab92824c83ff --- codex-rs/tui/src/pets/image_protocol.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/pets/image_protocol.rs b/codex-rs/tui/src/pets/image_protocol.rs index a2974cc50b..762b089e74 100644 --- a/codex-rs/tui/src/pets/image_protocol.rs +++ b/codex-rs/tui/src/pets/image_protocol.rs @@ -125,7 +125,7 @@ pub fn kitty_transmit_png_with_id( "{ESC}_Ga=T,t=d,f=100,c={columns},r={rows},q=2{image_id},m={more_flag},C=1;{chunk}{ST}", )); } else { - command.push_str(&format!("{ESC}_Gm={more_flag};{chunk}{ST}")); + command.push_str(&format!("{ESC}_Gm={more_flag},q=2;{chunk}{ST}")); } } @@ -210,6 +210,26 @@ mod tests { assert!(command.starts_with("\x1b_Ga=T,t=d,f=100,c=4,r=3,q=2,i=7,m=0,C=1;")); assert!(command.contains("cG5n")); assert!(command.ends_with("\x1b\\")); + + // Base64 encoding expands this payload to three chunks. + fs::write(&path, vec![0; 2 * KITTY_CHUNK_SIZE]).unwrap(); + let command = kitty_transmit_png_with_id( + &path, + /*columns*/ 4, + /*rows*/ 3, + KittyPlacement::Cursor(7), + ) + .unwrap(); + let headers = command + .split("\x1b_G") + .skip(1) + .map(|chunk| chunk.split_once(';').unwrap().0) + .collect::>(); + insta::assert_snapshot!(headers.join("\n"), @r" + a=T,t=d,f=100,c=4,r=3,q=2,i=7,m=1,C=1 + m=1,q=2 + m=0,q=2 + "); } #[test]