-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large images inconsistent display using direct mode #95
Comments
Thank you so much for taking the time to investigate this! |
Btw, I've only encountered this problem when using ssh, it doesn't occur during local development. |
Sounds related, but the image should be resized and hopefully much smaller, not sure where this breaks to cause this. |
no, just ssh |
Unfortunately I haven't had enough time to look into exactly why this is occurring, but even with the resizing, larger images can easily still go over the threshold for when this direct-mode "corruption" occurs (leading to the base64 text). For me at least, with the additional @ak2kay try #158 and see if it fixes, or helps at all |
This is something I've been exploring the cause of for a bit. Using kitty in direct-mode when displaying images (e.g. over SSH) occasionally causes images to not be displayed. I find this occurs regularly when the cropped + resized images are over 30kb.
The easiest way to test is by using
ssh localhost
, however, it occurs outside of ssh if you directly setis_SSH
inlua/image/backends/kitty/init.lua
. This happens both in and out of TMUX.During one of the failures, I noted that the characters received by the terminal (i.e. the output of
kitty --dump-commands
) included a 5 character addition and further in the sequence a 1 character deletion - causing everything within this section to become corrupted once decoded. However, the bytes as reported by lua before being sent appear to be correct.When using direct-mode, the protocol sends the 4096 base64 characters (effectively sending 3072 bytes each time) so 30kb is roughly 10 write-commands. When the file is small enough for only 9 write commands to be sufficient, the success rate is 90%, 10 commands is about 50% success, and 11 is about 10%.
Potential fix
I'm still trying to explore exactly what causes this issue, however, below is something I found which improves the success rate significantly. Annoyingly, it's another case of I can't explain why it helps.
I haven't had the issue occur at all using ssh AND tmux with this change. However, it will occasionally still occur when using JUST ssh. I'm still exploring, but if/when I come across something more conclusive I'll post a PR.
The text was updated successfully, but these errors were encountered: