diff options
Diffstat (limited to 'tests/model.c')
| -rw-r--r-- | tests/model.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/model.c b/tests/model.c index 4fd3737..8dead6c 100644 --- a/tests/model.c +++ b/tests/model.c @@ -727,9 +727,12 @@ static void pen_reset(struct pen *p) static void set_underline(uint16_t *attrs, int style) { - if (style > 5) style = 1; - *attrs = (uint16_t)((*attrs & ~TERM_ATTR_UNDERLINE_MASK) | - (unsigned)style << TERM_ATTR_UNDERLINE_SHIFT); + static const uint16_t flags[] = { + 0, TERM_ATTR_UNDERLINE, TERM_ATTR_DOUBLE_UNDERLINE, + TERM_ATTR_CURLY_UNDERLINE, TERM_ATTR_DOTTED_UNDERLINE, TERM_ATTR_DASHED_UNDERLINE, + }; + if ((unsigned)style > 5) style = 1; + *attrs = (uint16_t)((*attrs & ~TERM_ATTR_UNDERLINE_MASK) | flags[style]); } /* 38, 48, and 58. Returns the parameters it used after the first. */ @@ -814,7 +817,7 @@ static void sgr_report(const struct model *m, char *out, size_t cap) size_t n = 0; out[0] = 0; #define ADD(...) do { int k = snprintf(out + n, cap - n, __VA_ARGS__); if (k > 0) n += (size_t)k; } while (0) - int ul = (int)((p->attrs & TERM_ATTR_UNDERLINE_MASK) >> TERM_ATTR_UNDERLINE_SHIFT); + int ul = term_attr_underline(p->attrs); if (!(p->attrs & (TERM_ATTR_BOLD | TERM_ATTR_FAINT | TERM_ATTR_ITALIC | TERM_ATTR_STRIKE | TERM_ATTR_OVERLINE | TERM_ATTR_UNDERLINE_MASK)) && !p->inverse && p->fg == TERM_COLOR_FG && p->bg == TERM_COLOR_BG && !p->ul) |
