Fix small images on kitty
This commit is contained in:
		
							
								
								
									
										57
									
								
								terms.c
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								terms.c
									
									
									
									
									
								
							| @@ -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=%d,h=%d,c=%d,r=%d;", | ||||||
| 	w, h, x, y, sx, sy, sw, sh, cols, rows); | 	w, h, x, y, sx, sy, sw, sh, cols, rows); | ||||||
|  |  | ||||||
|     writestr(buf->ptr); |  | ||||||
|  |  | ||||||
|     cbuf = GC_MALLOC_ATOMIC(3072); |     cbuf = GC_MALLOC_ATOMIC(3072); | ||||||
|     i = 0; |     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) |     if (!base64) | ||||||
| 	return; | 	return; | ||||||
|  |  | ||||||
|  |     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); | ||||||
|  |  | ||||||
|     buf = Sprintf("%s\x1b\\", base64); |     buf = Sprintf("%s\x1b\\", base64); | ||||||
|     writestr(buf->ptr); |     writestr(buf->ptr); | ||||||
|     i = 0; |  | ||||||
|     base64 = NULL; |  | ||||||
|  |  | ||||||
|     while ((c = fgetc(fp)) != EOF) { |     if (c != EOF) { | ||||||
| 	if (!i && base64) { |       i = 0; | ||||||
| 	    buf = Sprintf("\x1b_Gm=1;%s\x1b\\", base64); |       base64 = NULL; | ||||||
| 	    writestr(buf->ptr); |       while ((c = fgetc(fp)) != EOF) { | ||||||
| 	} | 	  if (!i && base64) { | ||||||
| 	cbuf[i] = c; | 	      buf = Sprintf("\x1b_Gm=1;%s\x1b\\", base64); | ||||||
| 	++i; | 	      writestr(buf->ptr); | ||||||
| 	if (i == 3072) { | 	  } | ||||||
| 	    base64 = base64_encode(cbuf, i); | 	  cbuf[i] = c; | ||||||
| 	    if (!base64) | 	  ++i; | ||||||
| 		return; | 	  if (i == 3072) { | ||||||
|  | 	      base64 = base64_encode(cbuf, i); | ||||||
|  | 	      if (!base64) | ||||||
|  | 		  return; | ||||||
|  |  | ||||||
| 	    i = 0; | 	      i = 0; | ||||||
| 	} | 	  } | ||||||
|     } |       } | ||||||
|  |  | ||||||
|     if (i) { |       if (i) { | ||||||
| 	base64 = base64_encode(cbuf, i); | 	  base64 = base64_encode(cbuf, i); | ||||||
| 	if (!base64) | 	  if (!base64) | ||||||
| 	    return; | 	      return; | ||||||
|     } |       } | ||||||
|  |  | ||||||
|     if (base64) { |       if (base64) { | ||||||
| 	buf = Sprintf("\x1b_Gm=0;%s\x1b\\", base64); | 	  buf = Sprintf("\x1b_Gm=0;%s\x1b\\", base64); | ||||||
| 	writestr(buf->ptr); | 	  writestr(buf->ptr); | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|     MOVE(Currentbuf->cursorY, Currentbuf->cursorX); |     MOVE(Currentbuf->cursorY, Currentbuf->cursorX); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user