mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
term: modify term_fill() to optionally reset the SGR attributes
This commit is contained in:
parent
189cfd717f
commit
b3a84ba71b
3 changed files with 10 additions and 4 deletions
2
csi.c
2
csi.c
|
|
@ -1942,7 +1942,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
term, top, left, bottom - top + 1, right - left + 1);
|
term, top, left, bottom - top + 1, right - left + 1);
|
||||||
|
|
||||||
for (int r = top; r <= bottom; r++)
|
for (int r = top; r <= bottom; r++)
|
||||||
term_fill(term, r, left, c, right - left + 1);
|
term_fill(term, r, left, c, right - left + 1, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3511,17 +3511,22 @@ print_spacer(struct terminal *term, int col, int remaining)
|
||||||
* - double width characters not supported
|
* - double width characters not supported
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
struct row *row = grid_row(term->grid, r);
|
||||||
row->dirty = true;
|
row->dirty = true;
|
||||||
|
|
||||||
xassert(c + count <= term->cols);
|
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];
|
const struct cell *last = &row->cells[c + count];
|
||||||
for (struct cell *cell = &row->cells[c]; cell < last; cell++) {
|
for (struct cell *cell = &row->cells[c]; cell < last; cell++) {
|
||||||
cell->wc = data;
|
cell->wc = data;
|
||||||
cell->attrs = term->vt.attrs;
|
cell->attrs = attrs;
|
||||||
|
|
||||||
if (unlikely(term->vt.osc8.uri != NULL)) {
|
if (unlikely(term->vt.osc8.uri != NULL)) {
|
||||||
grid_row_uri_range_put(row, c, term->vt.osc8.uri, term->vt.osc8.id);
|
grid_row_uri_range_put(row, c, term->vt.osc8.uri, term->vt.osc8.id);
|
||||||
|
|
|
||||||
|
|
@ -798,7 +798,8 @@ void term_cursor_down(struct terminal *term, int count);
|
||||||
void term_cursor_blink_update(struct terminal *term);
|
void term_cursor_blink_update(struct terminal *term);
|
||||||
|
|
||||||
void term_print(struct terminal *term, char32_t wc, int width);
|
void term_print(struct terminal *term, char32_t wc, int width);
|
||||||
void term_fill(struct terminal *term, int row, int col, char c, size_t count);
|
void term_fill(struct terminal *term, int row, int col, char c, size_t count,
|
||||||
|
bool use_sgr_attrs);
|
||||||
|
|
||||||
void term_scroll(struct terminal *term, int rows);
|
void term_scroll(struct terminal *term, int rows);
|
||||||
void term_scroll_reverse(struct terminal *term, int rows);
|
void term_scroll_reverse(struct terminal *term, int rows);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue