From af6a37b1c4509c7766933a7cb45d2ee9a3a23f98 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 11:37:31 +0300 Subject: Return owned text and share cell attribute flags with snapshots Make text queries return allocated strings released with term_text_free, keeping each capture atomic. Align public attributes with the write core, remove snapshot conversion tables, and migrate tests and the Kitty adapter. --- tests/model.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests/model.c') 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) -- cgit v1.2.3