Skip to content

Kitty Graphics#13

Merged
mitchellh merged 7 commits intomainfrom
push-ntkuvmworqwt
Apr 6, 2026
Merged

Kitty Graphics#13
mitchellh merged 7 commits intomainfrom
push-ntkuvmworqwt

Conversation

@mitchellh
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh commented Apr 6, 2026

This brings in the new APIs from libghostty to enable Kitty Graphics supporting Ghostling.

This has very bad performance. The Ghostty part is alright, the issue is our render loop recreates and destroys the 2D image texture on every frame. This was a deliberate choice to keep the implementation simpler, but the performance is terrible if you have many images. 😄

Demo

CleanShot.2026-04-06.at.10.54.14.mp4

Use the new libghostty APIs from ghostty-org/ghostty#12147 to replace
manual logic in render_kitty_images:

The iterator layer filter (placement_iterator_set with a
GhosttyKittyPlacementLayer) replaces the manual z-index read and
switch/case filtering. The placement_viewport_pos call replaces
a 3-step viewport origin lookup (grid_ref, point_from_grid_ref,
manual subtraction) plus the off-screen and virtual-placement
checks. The placement_source_rect call replaces four individual
source field reads plus the "0 = full dimension" expansion and
bounds clamping.

This removes ~70 lines and drops the term_rows parameter from
both render_kitty_images and render_terminal.
@mitchellh mitchellh force-pushed the push-ntkuvmworqwt branch from 6f32d6d to de92501 Compare April 6, 2026 19:44
@mitchellh mitchellh merged commit aa58a30 into main Apr 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant