From 92a10ede11151847b8f08a7b460b91795ee27546 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 Apr 2021 13:13:19 -0400 Subject: [PATCH] Pull in tmt fixes from Martin Hughes fork Fix SGR being applied and fix default fg/bg color situation. --- confluent_vtbufferd/tmt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/confluent_vtbufferd/tmt.c b/confluent_vtbufferd/tmt.c index 76b7e700..efd081ea 100644 --- a/confluent_vtbufferd/tmt.c +++ b/confluent_vtbufferd/tmt.c @@ -214,13 +214,13 @@ HANDLER(sgr) #define FGBG(c) *(P0(i) < 40? &vt->attrs.fg : &vt->attrs.bg) = c for (size_t i = 0; i < vt->npar; i++) switch (P0(i)){ case 0: vt->attrs = defattrs; break; - case 1: case 22: vt->attrs.bold = P0(0) < 20; break; - case 2: case 23: vt->attrs.dim = P0(0) < 20; break; - case 4: case 24: vt->attrs.underline = P0(0) < 20; break; - case 5: case 25: vt->attrs.blink = P0(0) < 20; break; - case 7: case 27: vt->attrs.reverse = P0(0) < 20; break; - case 8: case 28: vt->attrs.invisible = P0(0) < 20; break; - case 10: case 11: vt->acs = P0(0) > 10; break; + case 1: case 22: vt->attrs.bold = P0(i) < 20; break; + case 2: case 23: vt->attrs.dim = P0(i) < 20; break; + case 4: case 24: vt->attrs.underline = P0(i) < 20; break; + case 5: case 25: vt->attrs.blink = P0(i) < 20; break; + case 7: case 27: vt->attrs.reverse = P0(i) < 20; break; + case 8: case 28: vt->attrs.invisible = P0(i) < 20; break; + case 10: case 11: vt->acs = P0(i) > 10; break; case 30: case 40: FGBG(TMT_COLOR_BLACK); break; case 31: case 41: FGBG(TMT_COLOR_RED); break; case 32: case 42: FGBG(TMT_COLOR_GREEN); break; @@ -366,6 +366,7 @@ tmt_open(size_t nline, size_t ncol, TMTCALLBACK cb, void *p, vt->decchars = L" ◆▒\t\f\r\n°±\n\v┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥π≠£•"; vt->cb = cb; vt->p = p; + vt->attrs = vt->oldattrs = defattrs; if (!tmt_resize(vt, nline, ncol)) return tmt_close(vt), NULL; return vt;