History

vt: fix background color on line feed

A command that causes a line feed while a background color is active, such as perl -e 'print "x" x 60, "\e[44m", "x" x 40, "\e[0m\n"' and perl -e 'print "x" x 40, "\e[44m\n", "x" x 40, "\e[0m\n"' causes the line that was started as a result of the line feed to be completely filled with the currently active background color instead of the default color. When scrolling, part of the current screen is memcpy'd/memmove'd to the new region, and the new line(s) that will appear as a result are cleared using memset. However, the lines are cleared with vc->vc_video_erase_char, causing them to be colored with the currently active background color. This is different from X11 terminal emulators which always paint the new lines with the default background color (e.g. `xterm -bg black`). The clear operation (\e[1J and \e[2J) also use vc_video_erase_char, so a new vc->vc_scrl_erase_char is introduced with contains the erase character used for scrolling, which is built from vc->vc_def_color instead of vc->vc_color.

Jan Engelhardt committed 18 years ago

Commit c9e587a1 parent 3265e666 files · +14 −12Browse files

Showing the changes to include/linux/console_struct.h (1 of 6 files). Show all

Unified · Split

include/linux/console_struct.h+1−0
@@ -53,6 +53,7 @@ struct vc_data { · 52 unmodified lines
5353 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
5454 struct console_font vc_font; /* Current VC font set */
5555 unsigned short vc_video_erase_char; /* Background erase character */
56+ unsigned short vc_scrl_erase_char; /* Erase character for scroll */
5657 /* VT terminal data */
5758 unsigned int vc_state; /* Escape sequence parser state */
5859 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */