Commit cd6937d4 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Greg Kroah-Hartman
Browse files

vt: support Unicode recomposition



Try replacing any decomposed Unicode sequence by the corresponding
recomposed code point. Code point to glyph correspondance works best
after recomposition, and this apply mostly to single-width code points
therefore we can't preserve them in their decomposed form anyway.

With all the infrastructure in place this is now trivial to do.

Signed-off-by: default avatarNicolas Pitre <npitre@baylibre.com>
Link: https://lore.kernel.org/r/20250410011839.64418-9-nico@fluxnic.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54af55b9
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2952,12 +2952,19 @@ static int vc_con_write_normal(struct vc_data *vc, int tc, int c,
				 * code point effectively making the later
				 * double-width.
				 */
			} else {
				/* try recomposition */
				prev_c = ucs_recompose(prev_c, c);
				if (prev_c != 0) {
					vc_con_rewind(vc);
					c = prev_c;
				} else {
					/* Otherwise zero-width code points are ignored */
					goto out;
				}
			}
		}
	}

	/* Now try to find out how to display it */
	tc = conv_uni_to_pc(vc, tc);