ttyraster: reset ANSI attributes after each line (#469)

This commit is contained in:
William Chargin 2022-07-09 01:38:35 -07:00 committed by GitHub
parent a9145e7f1e
commit 85aecbda67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -775,7 +775,7 @@ char *ttyraster(char *v, const struct TtyRgb *c, size_t yn, size_t xn,
struct Glyph glyph;
struct TtyRgb chun[4], lastchunk[4];
for (y = 0; y < yn; y += 2, c += xn) {
if (y) *v++ = '\r', *v++ = '\n';
if (y) v = stpcpy(v, "\e[0m\r\n");
for (x = 0; x < xn; x += 2, c += 2) {
CopyChunk(chun, c, xn);
if (ttyquant()->alg == kTtyQuantTrue) {
@ -795,6 +795,6 @@ char *ttyraster(char *v, const struct TtyRgb *c, size_t yn, size_t xn,
memcpy(lastchunk, chun, sizeof(chun));
}
}
*v = '\0';
v = stpcpy(v, "\e[0m");
return v;
}