From b3a84ba71b021b484e0ddc023480eb6d9f885991 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 26 Dec 2021 16:05:18 +0100 Subject: term: modify term_fill() to optionally reset the SGR attributes --- terminal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 8abe61e8..d826282b 100644 --- a/terminal.c +++ b/terminal.c @@ -3511,17 +3511,22 @@ print_spacer(struct terminal *term, int col, int remaining) * - double width characters not supported */ void -term_fill(struct terminal *term, int r, int c, char data, size_t count) +term_fill(struct terminal *term, int r, int c, char data, size_t count, + bool use_sgr_attrs) { struct row *row = grid_row(term->grid, r); row->dirty = true; xassert(c + count <= term->cols); + const struct attributes attrs = use_sgr_attrs + ? term->vt.attrs + : (struct attributes){0}; + const struct cell *last = &row->cells[c + count]; for (struct cell *cell = &row->cells[c]; cell < last; cell++) { cell->wc = data; - cell->attrs = term->vt.attrs; + cell->attrs = attrs; if (unlikely(term->vt.osc8.uri != NULL)) { grid_row_uri_range_put(row, c, term->vt.osc8.uri, term->vt.osc8.id); -- cgit v1.3