cosmopolitan/dsp/tty
William Chargin 4a1419fefa
ttyraster: restore colors at start of each line (#471)
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: 85aecbda67 ("ttyraster: reset ANSI attributes after each line (#469)")
wchargin-branch: ttyraster-restore-each-line
wchargin-source: 621a788cfa0a87ce360e142a6004e325cca70caa
2022-07-09 16:47:42 -07:00
..
altbuf.c Change license 2020-12-27 17:18:44 -08:00
config.c Change license 2020-12-27 17:18:44 -08:00
describe.c Change license 2020-12-27 17:18:44 -08:00
hidecursor.c Make exciting improvements 2022-03-18 03:02:00 -07:00
ident.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
identclear.c Change license 2020-12-27 17:18:44 -08:00
internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
itoa8.c Change license 2020-12-27 17:18:44 -08:00
itoa8.h Initial import 2020-06-15 07:18:57 -07:00
kcgapalette.c Initial import 2020-06-15 07:18:57 -07:00
ktangopalette.c Initial import 2020-06-15 07:18:57 -07:00
kxtermcubesteps.c Change license 2020-12-27 17:18:44 -08:00
kxtermpalette.c Initial import 2020-06-15 07:18:57 -07:00
mpsadbw.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
quant.h wip on intellisense (again) 2021-02-02 11:14:45 -05:00
restore.c Change license 2020-12-27 17:18:44 -08:00
rgb2ansi.c Improve memory safety 2021-10-13 17:27:13 -07:00
rgb2ttyf2i.c Change license 2020-12-27 17:18:44 -08:00
rgb2ttyi2f.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
rgb2xterm24.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
rgb2xterm24f.c Change license 2020-12-27 17:18:44 -08:00
savecursor.c Change license 2020-12-27 17:18:44 -08:00
send.c Change license 2020-12-27 17:18:44 -08:00
sendtitle.c Remove garbage collector macro from header (#114) 2021-03-07 20:23:29 -08:00
setansipalette.c Change license 2020-12-27 17:18:44 -08:00
setbgfg16.c Change license 2020-12-27 17:18:44 -08:00
setbgfg24.c Change license 2020-12-27 17:18:44 -08:00
setbgfg256.c Change license 2020-12-27 17:18:44 -08:00
setraw.c Make improvements 2022-04-24 10:06:05 -07:00
setrawdeadline.c Change license 2020-12-27 17:18:44 -08:00
setrawmode.c Change license 2020-12-27 17:18:44 -08:00
tty.h Add pseudoteletypewriter to emulator 2020-08-29 23:51:09 -07:00
tty.mk Make C memory safe like Rust 2021-02-01 03:58:46 -08:00
tty2rgb24.c Change license 2020-12-27 17:18:44 -08:00
tty2rgbf24.c Change license 2020-12-27 17:18:44 -08:00
ttyhisto.c Change license 2020-12-27 17:18:44 -08:00
ttymove.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ttyquant.c Change license 2020-12-27 17:18:44 -08:00
ttyraster.c ttyraster: restore colors at start of each line (#471) 2022-07-09 16:47:42 -07:00
ttyraw.c Reduce makefile dependencies by 10% 2022-06-08 20:01:28 -07:00
ttyrgb.h Initial import 2020-06-15 07:18:57 -07:00
windex-avx2.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
windex-k8.c Fix Clang support 2021-02-06 00:29:09 -08:00
windex-sse4.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
windex.h Initial import 2020-06-15 07:18:57 -07:00
windex.S Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
write.c Change license 2020-12-27 17:18:44 -08:00
xtermname.c Change license 2020-12-27 17:18:44 -08:00
xtermname.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00