Fix image aspect ratio by querying terminal cell size

- Add getCellDimensions/setCellDimensions to terminal-image.ts
- TUI queries cell size on startup via CSI 16 t
- Parse response and filter it from user input
- Invalidate and re-render when cell dimensions received
- Pass rows parameter to Kitty protocol for correct aspect ratio
This commit is contained in:
Mario Zechner 2025-12-13 23:09:05 +01:00
parent fcad447f32
commit 215c10664a
3 changed files with 93 additions and 9 deletions

View file

@ -27,6 +27,7 @@ export {
encodeITerm2,
encodeKitty,
getCapabilities,
getCellDimensions,
getGifDimensions,
getImageDimensions,
getJpegDimensions,
@ -38,6 +39,7 @@ export {
imageFallback,
renderImage,
resetCapabilitiesCache,
setCellDimensions,
type TerminalCapabilities,
} from "./terminal-image.js";
export { type Component, Container, TUI } from "./tui.js";