mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-24 18:20:59 +00:00
The patch in #469 was buggy for images where the start of a row matched
the end of the previous row. We don't re-issue the `setbgfg` ANSI codes
when we think that the color hasn't changed. But by sending an `\e[0m`
sequence at the end of the line without updating `bg` or `fg`, we
desynced `bg` and `fg` from the actual ANSI state. Now, we simply follow
that line-terminating `\e[0m` with another `setbgfg` call.
This bug was visible in images with a constant-color matte border:
![Screenshot of `printimage` output before and after this commit when
run on `lemurs.png` and `lemursborder.png`, where `lemursborder.png` has
a thick blue border around the outside of the image. Both versions look
fine for `lemurs.png`. For `lemursborder.png`, the "before" version has
a chess board pattern for the left border (except for the first row) and
the bottom border. The "after" version looks correct.][ss]
[ss]: https://user-images.githubusercontent.com/4317806/178120511-c1b89348-2376-4bf2-a2d3-8723d2663bd4.png
Fixes:
|
||
|---|---|---|
| .. | ||
| altbuf.c | ||
| config.c | ||
| describe.c | ||
| hidecursor.c | ||
| ident.c | ||
| identclear.c | ||
| internal.h | ||
| itoa8.c | ||
| itoa8.h | ||
| kcgapalette.c | ||
| ktangopalette.c | ||
| kxtermcubesteps.c | ||
| kxtermpalette.c | ||
| mpsadbw.S | ||
| quant.h | ||
| restore.c | ||
| rgb2ansi.c | ||
| rgb2ttyf2i.c | ||
| rgb2ttyi2f.c | ||
| rgb2xterm24.c | ||
| rgb2xterm24f.c | ||
| savecursor.c | ||
| send.c | ||
| sendtitle.c | ||
| setansipalette.c | ||
| setbgfg16.c | ||
| setbgfg24.c | ||
| setbgfg256.c | ||
| setraw.c | ||
| setrawdeadline.c | ||
| setrawmode.c | ||
| tty.h | ||
| tty.mk | ||
| tty2rgb24.c | ||
| tty2rgbf24.c | ||
| ttyhisto.c | ||
| ttymove.c | ||
| ttyquant.c | ||
| ttyraster.c | ||
| ttyraw.c | ||
| ttyrgb.h | ||
| windex-avx2.S | ||
| windex-k8.c | ||
| windex-sse4.S | ||
| windex.h | ||
| windex.S | ||
| write.c | ||
| xtermname.c | ||
| xtermname.h | ||