vt: make sure displayed double-width characters are remembered as such

And to do so we ensure the Unicode screen buffer is initialized when
double-width characters are encountered.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Link: https://lore.kernel.org/r/20250507141535.40655-3-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Nicolas Pitre
2025-05-07 10:13:17 -04:00
committed by Greg Kroah-Hartman
parent a16014c0db
commit 68e7a421ab

View File

@@ -2930,8 +2930,15 @@ static int vc_process_ucs(struct vc_data *vc, int *c, int *tc)
{
u32 prev_c, curr_c = *c;
if (ucs_is_double_width(curr_c))
if (ucs_is_double_width(curr_c)) {
/*
* The Unicode screen memory is allocated only when
* required. This is one such case as we need to remember
* which displayed characters are double-width.
*/
vc_uniscr_check(vc);
return 2;
}
if (!ucs_is_zero_width(curr_c))
return 1;