Erase in Line (EL) with the default "Erase to Right" action erases the whole line
Using 06046179 to test.
Reproducer:
$ echo -ne '\e[?1049h\e[m\e[39;49m\e[2J\e[10;43H\e[44m\e[K' > /dev/pts/X
where /dev/pts/X
is connected to a VTE terminal.
The control sequences above:
- Saves the cursor and uses the alternate screen buffer.
- Sets the default background/foreground colours and resets the attributes.
- Clears the screen.
- Moves the cursor to (42, 9).
- Sets the background colour to blue.
- Erases the line to the right of the cursor (
\e[K
; default action 0).
However, the whole row 9 becomes blue, not just from column 42 until the end of the row:
This ultimately calls Terminal::clear_to_eol()
which does this:
bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
if (not_default_bg) {
/* Add enough cells to fill out the row. */
_vte_row_data_fill(rowdata, &m_color_defaults, m_column_count);
}
At this point, for some reason, rowdata
is empty (has no cells). m_column_count
is 80 in my case.
In _vte_row_data_fill()
, we have this:
if (row->len < len) {
gulong i;
if (G_UNLIKELY (!_vte_row_data_ensure (row, len)))
return;
for (i = row->len; i < len; i++)
row->cells[i] = *cell;
row->len = len;
}
As I wrote above, row->len
is 0 here. So this loop indeed makes i
go from 0 to 79, clearing all the row's cells.
The following terminal emulators clear the cells at the right of the cursor as expected:
- kitty 0.17.3
- XTerm 356
- urxvt 9.22
- Konsole 20.04.1
- Linux console 5.6.13
In my case, ncurses decides to use \e[K
; I can't control it.