Repository navigation
terminal/kitty: abort incomplete graphics loads - #13893
Merged
Merged
Conversation
Previously, delete left partial bytes alive for the next upload, while failed or incomplete retransmissions kept stale placements visible. Abort incomplete chunked image uploads on delete commands and remove an existing image and its placements when retransmission of an explicit ID begins.
Contributor
Author
|
Verification: #!/bin/sh
set -eu
# Run this directly inside Kitty or Ghostty (not through tmux/screen).
# It uses 1x1 RGB pixels scaled to visible cell rectangles.
id_abort=8008
id_fresh=8009
id_replace=8010
kgp() {
printf '\033_G%s\033\\' "$1"
}
delete_id() {
kgp "a=d,d=I,i=$1,q=2"
}
cleanup() {
delete_id "$id_abort"
delete_id "$id_fresh"
delete_id "$id_replace"
}
pause() {
printf '\nPress Return to continue... '
IFS= read -r _
}
move_to() {
printf '\033[%s;%sH' "$1" "$2"
}
clear_below() {
move_to "$1" 1
printf '\033[J'
}
trap cleanup EXIT HUP INT TERM
cleanup
printf '\033[2J\033[H'
printf '%s\n' 'KGP-08 test 1: a delete aborts an incomplete upload.'
printf '%s\n\n' 'Expected: a GREEN rectangle appears below.'
move_to 4 1
# Begin a complete red pixel but claim another chunk is coming. The image is
# not displayed. Any delete command must discard this partial upload.
kgp "a=t,f=24,s=1,v=1,i=$id_abort,m=1,q=2;/wAA"
kgp 'a=d,q=2'
# A fresh two-command upload should now work and display a green pixel scaled
# to 12 columns by 2 rows. The last chunk is intentionally empty.
kgp "a=T,f=24,s=1,v=1,i=$id_fresh,c=12,r=2,C=1,m=1,q=2;AP8A"
kgp 'm=0,q=2;'
clear_below 7
printf '%s\n' 'PASS if the green rectangle is visible; FAIL if this area stayed blank.'
pause
cleanup
printf '\033[2J\033[H'
printf '%s\n' 'KGP-08 test 2: retransmission invalidates the old placement immediately.'
printf '%s\n\n' 'A RED rectangle should initially be visible below.'
move_to 4 1
# Display the old red image and keep the cursor outside its rectangle.
kgp "a=T,f=24,s=1,v=1,i=$id_replace,c=12,r=2,C=1,q=2;/wAA"
clear_below 7
printf '%s\n' 'Confirm the red rectangle is visible.'
pause
# Start, but do not finish, a green replacement using the same explicit ID.
# The old red placement must disappear as soon as this first chunk arrives.
kgp "a=t,f=24,s=1,v=1,i=$id_replace,m=1,q=2;AP8A"
clear_below 7
printf '%s\n' 'PASS if the red rectangle vanished; FAIL if it is still visible.'
printf '%s\n' 'The replacement is incomplete, so no green rectangle should appear yet.'
pause
# Complete the transmit-only replacement, then place it to prove it loaded.
kgp 'm=0,q=2;'
move_to 4 1
kgp "a=p,i=$id_replace,c=12,r=2,C=1,q=2"
clear_below 7
printf '%s\n' 'The replacement is complete. A GREEN rectangle should be visible.'
printf '%s\n' 'Done. Both terminals should show the same three PASS states.'
pause
|
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.
Previously, delete left partial bytes alive for the next upload, while failed or incomplete retransmissions kept stale placements visible.
Abort incomplete chunked image uploads on delete commands and remove an existing image and its placements when retransmission of an explicit ID begins.