term: call grid_row_uri_range_erase() when printing cells

This commit is contained in:
Daniel Eklöf 2021-11-20 13:54:30 +01:00
parent 1a0de0017f
commit 09a331857a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -3162,6 +3162,8 @@ term_print(struct terminal *term, wchar_t wc, int width)
{ {
xassert(width > 0); xassert(width > 0);
struct grid *grid = term->grid;
if (unlikely(term->charsets.set[term->charsets.selected] == CHARSET_GRAPHIC) && if (unlikely(term->charsets.set[term->charsets.selected] == CHARSET_GRAPHIC) &&
wc >= 0x60 && wc <= 0x7e) wc >= 0x60 && wc <= 0x7e)
{ {
@ -3180,24 +3182,26 @@ term_print(struct terminal *term, wchar_t wc, int width)
print_linewrap(term); print_linewrap(term);
print_insert(term, width); print_insert(term, width);
int col = grid->cursor.point.col;
if (unlikely(width > 1) && likely(term->auto_margin) && if (unlikely(width > 1) && likely(term->auto_margin) &&
term->grid->cursor.point.col + width > term->cols) col + width > term->cols)
{ {
/* Multi-column character that doesn't fit on current line - /* Multi-column character that doesn't fit on current line -
* pad with spacers */ * pad with spacers */
for (size_t i = term->grid->cursor.point.col; i < term->cols; i++) for (size_t i = col; i < term->cols; i++)
print_spacer(term, i, 0); print_spacer(term, i, 0);
/* And force a line-wrap */ /* And force a line-wrap */
term->grid->cursor.lcf = 1; grid->cursor.lcf = 1;
print_linewrap(term); print_linewrap(term);
} }
sixel_overwrite_at_cursor(term, width); sixel_overwrite_at_cursor(term, width);
/* *Must* get current cell *after* linewrap+insert */ /* *Must* get current cell *after* linewrap+insert */
struct row *row = term->grid->cur_row; struct row *row = grid->cur_row;
struct cell *cell = &row->cells[term->grid->cursor.point.col]; struct cell *cell = &row->cells[col];
cell->wc = term->vt.last_printed = wc; cell->wc = term->vt.last_printed = wc;
cell->attrs = term->vt.attrs; cell->attrs = term->vt.attrs;
@ -3205,18 +3209,22 @@ term_print(struct terminal *term, wchar_t wc, int width)
row->dirty = true; row->dirty = true;
row->linebreak = true; row->linebreak = true;
grid_row_uri_range_erase(row, col, col + width - 1);
/* Advance cursor the 'additional' columns while dirty:ing the cells */ /* Advance cursor the 'additional' columns while dirty:ing the cells */
for (int i = 1; i < width && term->grid->cursor.point.col < term->cols - 1; i++) { for (int i = 1; i < width && col < term->cols - 1; i++) {
term->grid->cursor.point.col++; col++;
print_spacer(term, term->grid->cursor.point.col, width - i); print_spacer(term, col, width - i);
} }
/* Advance cursor */ /* Advance cursor */
if (unlikely(++term->grid->cursor.point.col >= term->cols)) { if (unlikely(++col >= term->cols)) {
term->grid->cursor.lcf = true; grid->cursor.lcf = true;
term->grid->cursor.point.col--; col--;
} else } else
xassert(!term->grid->cursor.lcf); xassert(!grid->cursor.lcf);
grid->cursor.point.col = col;
} }
static void static void
@ -3228,15 +3236,18 @@ ascii_printer_generic(struct terminal *term, wchar_t wc)
static void static void
ascii_printer_fast(struct terminal *term, wchar_t wc) ascii_printer_fast(struct terminal *term, wchar_t wc)
{ {
struct grid *grid = term->grid;
xassert(term->charsets.set[term->charsets.selected] == CHARSET_ASCII); xassert(term->charsets.set[term->charsets.selected] == CHARSET_ASCII);
xassert(!term->insert_mode); xassert(!term->insert_mode);
xassert(tll_length(term->grid->sixel_images) == 0); xassert(tll_length(grid->sixel_images) == 0);
print_linewrap(term); print_linewrap(term);
/* *Must* get current cell *after* linewrap+insert */ /* *Must* get current cell *after* linewrap+insert */
struct row *row = term->grid->cur_row; int col = grid->cursor.point.col;
struct cell *cell = &row->cells[term->grid->cursor.point.col]; struct row *row = grid->cur_row;
struct cell *cell = &row->cells[col];
cell->wc = term->vt.last_printed = wc; cell->wc = term->vt.last_printed = wc;
cell->attrs = term->vt.attrs; cell->attrs = term->vt.attrs;
@ -3244,12 +3255,16 @@ ascii_printer_fast(struct terminal *term, wchar_t wc)
row->dirty = true; row->dirty = true;
row->linebreak = true; row->linebreak = true;
grid_row_uri_range_erase(row, col, col);
/* Advance cursor */ /* Advance cursor */
if (unlikely(++term->grid->cursor.point.col >= term->cols)) { if (unlikely(++col >= term->cols)) {
term->grid->cursor.lcf = true; grid->cursor.lcf = true;
term->grid->cursor.point.col--; col--;
} else } else
xassert(!term->grid->cursor.lcf); xassert(!grid->cursor.lcf);
grid->cursor.point.col = col;
} }
static void static void