Fix imgcat aspect ratio by adding preserveAspectRatio=1

Images were being displayed as narrow vertical strips because
iTerm2 wasn't preserving aspect ratio when only height was specified.
This commit is contained in:
Dhanji R. Prasanna
2026-01-17 18:50:00 +05:30
parent 0234920446
commit 3a03ed0585

View File

@@ -738,9 +738,9 @@ pub fn print_imgcat(
.file_name() .file_name()
.and_then(|f| f.to_str()) .and_then(|f| f.to_str())
.unwrap_or(name); .unwrap_or(name);
// iTerm2 inline image protocol (single space prefix) // iTerm2 inline image protocol with preserveAspectRatio (single space prefix)
print!( print!(
" \x1b]1337;File=inline=1;height={};name={}:{}\x07\n", " \x1b]1337;File=inline=1;height={};preserveAspectRatio=1;name={}:{}\x07\n",
max_height, name, encoded max_height, name, encoded
); );
// Print dimmed info line with filename only (no │ prefix) // Print dimmed info line with filename only (no │ prefix)