diff options
Diffstat (limited to 'terms.c')
-rw-r--r-- | terms.c | 63 |
1 files changed, 35 insertions, 28 deletions
@@ -576,7 +576,6 @@ put_image_kitty(char *url, int x, int y, int w, int h, int sx, int sy, int sw, "w=%d,h=%d,c=%d,r=%d;", w, h, x, y, sx, sy, sw, sh, cols, rows); - writestr(buf->ptr); cbuf = GC_MALLOC_ATOMIC(3072); i = 0; @@ -591,36 +590,44 @@ put_image_kitty(char *url, int x, int y, int w, int h, int sx, int sy, int sw, if (!base64) return; - buf = Sprintf("%s\x1b\\", base64); + if (c == EOF) + buf = Sprintf("\x1b_Gf=100,s=%d,v=%d,a=T,m=0,X=%d,Y=%d,x=%d,y=%d," + "w=%d,h=%d,c=%d,r=%d;", + w, h, x, y, sx, sy, sw, sh, cols, rows); writestr(buf->ptr); - i = 0; - base64 = NULL; - while ((c = fgetc(fp)) != EOF) { - if (!i && base64) { - buf = Sprintf("\x1b_Gm=1;%s\x1b\\", base64); - writestr(buf->ptr); - } - cbuf[i] = c; - ++i; - if (i == 3072) { - base64 = base64_encode(cbuf, i); - if (!base64) - return; - - i = 0; - } - } - - if (i) { - base64 = base64_encode(cbuf, i); - if (!base64) - return; - } + buf = Sprintf("%s\x1b\\", base64); + writestr(buf->ptr); - if (base64) { - buf = Sprintf("\x1b_Gm=0;%s\x1b\\", base64); - writestr(buf->ptr); + if (c != EOF) { + i = 0; + base64 = NULL; + while ((c = fgetc(fp)) != EOF) { + if (!i && base64) { + buf = Sprintf("\x1b_Gm=1;%s\x1b\\", base64); + writestr(buf->ptr); + } + cbuf[i] = c; + ++i; + if (i == 3072) { + base64 = base64_encode(cbuf, i); + if (!base64) + return; + + i = 0; + } + } + + if (i) { + base64 = base64_encode(cbuf, i); + if (!base64) + return; + } + + if (base64) { + buf = Sprintf("\x1b_Gm=0;%s\x1b\\", base64); + writestr(buf->ptr); + } } MOVE(Currentbuf->cursorY, Currentbuf->cursorX); } |