vt: make sure displayed double-width characters are remembered as such
authorNicolas Pitre <npitre@baylibre.com>
Wed, 7 May 2025 14:13:17 +0000 (10:13 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 May 2025 11:39:45 +0000 (13:39 +0200)
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>
drivers/tty/vt/vt.c

index 24c6cd2eed78b6395c6beeb06087e14dd16a33bf..58fa1b285f22b95d00f818860b86c39b90f986d5 100644 (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;