Repository navigation
libghostty-vt: expose a Kitty placement's parent, relative offsets and id kind in the C API #15228
Unanswered
spankyed
asked this question in
Feature Requests, Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm embedding
libghostty-vtthrough the C API in a terminal broker: it owns the pty and sends rows and image placements to separate views that draw them. The views keep scrollback, so I need to say where an image is on any line, not only on the visible screen.What works
For the visible screen, the render state's image list gives a resolved position for every placement kind, including relative ones. That part is great and I'm using it.
What I can't get
GhosttyKittyGraphicsPlacementDatahas the image id, placement id,IS_VIRTUAL, pixel offsets, source rectangle, columns, rows and z. For a relative placement (P=/Q=/H=/V=) there is no way to read:H/Vcell offsets,1and a program1look identical through the API.Why it matters
Proposal
Add keys to
GhosttyKittyGraphicsPlacementData. All of this is already stored on the placement, and the values are additive:IS_INTERNAL_ID(bool)IS_RELATIVE(bool)PARENT_IMAGE_ID,PARENT_PLACEMENT_ID(uint32),PARENT_IS_INTERNAL_ID(bool)HORIZONTAL_OFFSET,VERTICAL_OFFSET(int32, cells)The parent and offset keys return
GHOSTTY_NO_VALUEfor a placement that isn't relative.An alternative would be a function that resolves a relative placement's chain to its root position plus accumulated offsets. That is less work for embedders but a bigger API surface, so I went with the plain getters.
Branch
spankyed#1
All reactions