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
This commit is contained in:
Eric Traut
2026-11-25 22:40:59 +00:00
committed by copyberry
parent a089ec6a93
commit db360f8b00
+21 -1
View File
@@ -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::<Vec<_>>();
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]