From f82ad106671ca004aaa7c3cdf727f5827812d595 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 27 Nov 2020 15:29:38 -0500 Subject: [PATCH] Properly set italics/struck following sgr #1138 --- src/lib/render.c | 3 ++- src/poc/sgr-full.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/render.c b/src/lib/render.c index 79eb6ac58..680137a08 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -558,8 +558,9 @@ term_setstyles(FILE* out, uint32_t* curattr, const cell* c, bool* normalized, out, false) < 0){ ret = -1; } + // sgr will blow away italics/struck if they were set beforehand + *curattr &= !(NCSTYLE_ITALIC | NCSTYLE_STRUCK); } - // sgr will blow away italics/struck if they were set beforehand ret |= term_setstyle(out, *curattr, cellattr, NCSTYLE_ITALIC, italics, italoff); ret |= term_setstyle(out, *curattr, cellattr, NCSTYLE_STRUCK, struck, struckoff); *curattr = cellattr; diff --git a/src/poc/sgr-full.c b/src/poc/sgr-full.c index 3b0e3a30a..e32321a00 100644 --- a/src/poc/sgr-full.c +++ b/src/poc/sgr-full.c @@ -42,6 +42,12 @@ int main(void){ ncplane_putstr_yx(n, y++, 0, "a ═ struck underline"); ncplane_set_styles(n, NCSTYLE_STRUCK | NCSTYLE_BLINK); ncplane_putstr_yx(n, y++, 0, "a ═ struck blink"); + ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_REVERSE); + ncplane_putstr_yx(n, y++, 0, "a ═ bold reverse"); + ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_UNDERLINE); + ncplane_putstr_yx(n, y++, 0, "a ═ bold underline"); + ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_BLINK); + ncplane_putstr_yx(n, y++, 0, "a ═ bold blink"); ncplane_putstr_yx(n, y++, 0, "sleeping for 15s..."); if(notcurses_render(nc)){ goto err;