feat(image): add image_quiet option to set the kitty graphics q flag#349
Open
vantroy wants to merge 1 commit into
Open
feat(image): add image_quiet option to set the kitty graphics q flag#349vantroy wants to merge 1 commit into
vantroy wants to merge 1 commit into
Conversation
Suppresses the terminal's responses to image transmit, placement, and delete commands so they cannot leak to the shell when an app exits before its reader drains them. Defaults to .off (behavior unchanged).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in
Vaxis.Options.image_quietfield that sets the Kitty graphicsquietness (
q) flagon the image transmit, placement, and delete commands. Default is
.off, soexisting behavior is byte-for-byte unchanged.
q.off.no_ok.silentMotivation
When a cell holds an image, vaxis re-emits its placement every frame (image
cells are exempt from the render diff), and the terminal acknowledges each one
with
_Gi=N;OK. Transmit and delete are acked too. During a session the readerthread consumes these, but an application that tears down without draining the
tty (for example, restoring the terminal and
exit()ing while a final ack or amid-upload transmit ack is still round-tripping) leaks the ack onto the shell
prompt as visible garbage (
^[_Gi=1;OK^[\). It is most reproducible overbatched/high-latency links (tmux, SSH), where a backlog of acks arrives after
the app is gone.
Nothing in vaxis depends on these responses: the parser routes every
_GAPCto the capability-detection path, which is a no-op after the first one. So
suppressing them is purely removing noise. Doing it unconditionally would change
wire behavior for every consumer, so it is gated behind the option and defaults
off.
.no_okis offered for callers who still want to observe graphics failureswhile silencing the success chatter.
Coverage
The flag is applied at every image-command emission:
transmitLocalImagePath(rgb/rgba/png),
transmitPreEncodedImage(chunked and non-chunked; the quietflag is set on the first chunk, per the protocol), the
renderandprettyPrintplacements,
freeImage, and the bulk delete-all on the hard-reset path. Thecapability query (
a=q) is intentionally left untouched; its response is the onevaxis reads for capability detection.
Tests
Four tests assert the wire output:
.silentemits,q=2on transmit and onfreeImage,.no_okemits,q=1on transmit, and.offemits noq=(confirming the non-breaking default).
Open question (happy to adjust)
The
q=1variant is named.no_ok, mirroring the protocol's "suppress OKresponses" wording;
.errors_onlyis an alternative if you'd prefer it readwithout protocol context. Likewise I went with a tri-state enum to expose the
q=1/q=2distinction (error visibility), but a plainboolforq=2is easyif you'd rather keep the surface minimal.