From d46af6bd7ac7606bf99d63b2453b656a5defb892 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 20 Nov 2021 16:29:57 +0100 Subject: term: track cell color source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each cell now tracks it’s current color source: * default fg/bg * base16 fg/bg (maps to *both* the regular and bright colors) * base256 fg/bg * RGB Note that we don’t have enough bits to separate the regular from the bright colors. These _shouldn’t_ be the same, so we ought to be fine... --- terminal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index df8128fc..bf13dd46 100644 --- a/terminal.c +++ b/terminal.c @@ -1770,11 +1770,13 @@ erase_cell_range(struct terminal *term, struct row *row, int start, int end) row->dirty = true; - if (unlikely(term->vt.attrs.have_bg)) { + const enum color_source bg_src = term->vt.attrs.bg_src; + + if (unlikely(bg_src != COLOR_DEFAULT)) { for (int col = start; col <= end; col++) { struct cell *c = &row->cells[col]; c->wc = 0; - c->attrs = (struct attributes){.have_bg = 1, .bg = term->vt.attrs.bg}; + c->attrs = (struct attributes){.bg_src = bg_src, .bg = term->vt.attrs.bg}; } } else memset(&row->cells[start], 0, (end - start + 1) * sizeof(row->cells[0])); -- cgit v1.3