v2-0004-Extend-collection-of-Unicode-combining-characters.patch

application/octet-stream

Filename: v2-0004-Extend-collection-of-Unicode-combining-characters.patch
Type: application/octet-stream
Part: 0
Message: Re: badly calculated width of emoji in psql

Patch

Format: format-patch
Series: patch v2-0004
Subject: Extend collection of Unicode combining characters to beyond the BMP
File+
src/common/unicode/generate-unicode_width_table.pl 0 2
src/include/common/unicode_width_table.h 102 0
From bfa81d710bbbac6b82228e2d9f30a1856598a443 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Fri, 20 Aug 2021 12:35:32 -0400
Subject: [PATCH v2 4/4] Extend collection of Unicode combining characters to
 beyond the BMP

The former limit was perhaps a carryover from an older hand-coded
table.
---
 .../unicode/generate-unicode_width_table.pl   |   2 -
 src/include/common/unicode_width_table.h      | 102 ++++++++++++++++++
 2 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/src/common/unicode/generate-unicode_width_table.pl b/src/common/unicode/generate-unicode_width_table.pl
index 1f8ddc6331..5a361d82d4 100644
--- a/src/common/unicode/generate-unicode_width_table.pl
+++ b/src/common/unicode/generate-unicode_width_table.pl
@@ -30,8 +30,6 @@ foreach my $line (<$UD>)
 	my @fields = split ';', $line;
 	$codepoint = hex $fields[0];
 
-	next if $codepoint > 0xFFFF;
-
 	if ($fields[2] eq 'Me' || $fields[2] eq 'Mn')
 	{
 		# combining character, save for start of range
diff --git a/src/include/common/unicode_width_table.h b/src/include/common/unicode_width_table.h
index 5b7b6e15e2..b8908d90b0 100644
--- a/src/include/common/unicode_width_table.h
+++ b/src/include/common/unicode_width_table.h
@@ -252,7 +252,93 @@ static const struct mbinterval wcwidth[] = {
 	{0xFE68, 0xFE6B, 2},
 	{0xFF01, 0xFF60, 2},
 	{0xFFE0, 0xFFE6, 2},
+	{0x101FD, 0x101FD, 0},
+	{0x102E0, 0x102E0, 0},
+	{0x10376, 0x1037A, 0},
+	{0x10A01, 0x10A0F, 0},
+	{0x10A38, 0x10A3F, 0},
+	{0x10AE5, 0x10AE6, 0},
+	{0x10D24, 0x10D27, 0},
+	{0x10EAB, 0x10EAC, 0},
+	{0x10F46, 0x10F50, 0},
+	{0x11001, 0x11001, 0},
+	{0x11038, 0x11046, 0},
+	{0x1107F, 0x11081, 0},
+	{0x110B3, 0x110B6, 0},
+	{0x110B9, 0x110BA, 0},
+	{0x11100, 0x11102, 0},
+	{0x11127, 0x1112B, 0},
+	{0x1112D, 0x11134, 0},
+	{0x11173, 0x11173, 0},
+	{0x11180, 0x11181, 0},
+	{0x111B6, 0x111BE, 0},
+	{0x111C9, 0x111CC, 0},
+	{0x111CF, 0x111CF, 0},
+	{0x1122F, 0x11231, 0},
+	{0x11234, 0x11234, 0},
+	{0x11236, 0x11237, 0},
+	{0x1123E, 0x1123E, 0},
+	{0x112DF, 0x112DF, 0},
+	{0x112E3, 0x112EA, 0},
+	{0x11300, 0x11301, 0},
+	{0x1133B, 0x1133C, 0},
+	{0x11340, 0x11340, 0},
+	{0x11366, 0x11374, 0},
+	{0x11438, 0x1143F, 0},
+	{0x11442, 0x11444, 0},
+	{0x11446, 0x11446, 0},
+	{0x1145E, 0x1145E, 0},
+	{0x114B3, 0x114B8, 0},
+	{0x114BA, 0x114BA, 0},
+	{0x114BF, 0x114C0, 0},
+	{0x114C2, 0x114C3, 0},
+	{0x115B2, 0x115B5, 0},
+	{0x115BC, 0x115BD, 0},
+	{0x115BF, 0x115C0, 0},
+	{0x115DC, 0x115DD, 0},
+	{0x11633, 0x1163A, 0},
+	{0x1163D, 0x1163D, 0},
+	{0x1163F, 0x11640, 0},
+	{0x116AB, 0x116AB, 0},
+	{0x116AD, 0x116AD, 0},
+	{0x116B0, 0x116B5, 0},
+	{0x116B7, 0x116B7, 0},
+	{0x1171D, 0x1171F, 0},
+	{0x11722, 0x11725, 0},
+	{0x11727, 0x1172B, 0},
+	{0x1182F, 0x11837, 0},
+	{0x11839, 0x1183A, 0},
+	{0x1193B, 0x1193C, 0},
+	{0x1193E, 0x1193E, 0},
+	{0x11943, 0x11943, 0},
+	{0x119D4, 0x119DB, 0},
+	{0x119E0, 0x119E0, 0},
+	{0x11A01, 0x11A0A, 0},
+	{0x11A33, 0x11A38, 0},
+	{0x11A3B, 0x11A3E, 0},
+	{0x11A47, 0x11A47, 0},
+	{0x11A51, 0x11A56, 0},
+	{0x11A59, 0x11A5B, 0},
+	{0x11A8A, 0x11A96, 0},
+	{0x11A98, 0x11A99, 0},
+	{0x11C30, 0x11C3D, 0},
+	{0x11C3F, 0x11C3F, 0},
+	{0x11C92, 0x11CA7, 0},
+	{0x11CAA, 0x11CB0, 0},
+	{0x11CB2, 0x11CB3, 0},
+	{0x11CB5, 0x11CB6, 0},
+	{0x11D31, 0x11D45, 0},
+	{0x11D47, 0x11D47, 0},
+	{0x11D90, 0x11D91, 0},
+	{0x11D95, 0x11D95, 0},
+	{0x11D97, 0x11D97, 0},
+	{0x11EF3, 0x11EF4, 0},
+	{0x16AF0, 0x16AF4, 0},
+	{0x16B30, 0x16B36, 0},
+	{0x16F4F, 0x16F4F, 0},
+	{0x16F8F, 0x16F92, 0},
 	{0x16FE0, 0x16FE4, 2},
+	{0x16FE4, 0x16FE4, 0},
 	{0x16FF0, 0x16FF1, 2},
 	{0x17000, 0x187F7, 2},
 	{0x18800, 0x18CD5, 2},
@@ -261,6 +347,21 @@ static const struct mbinterval wcwidth[] = {
 	{0x1B150, 0x1B152, 2},
 	{0x1B164, 0x1B167, 2},
 	{0x1B170, 0x1B2FB, 2},
+	{0x1BC9D, 0x1BC9E, 0},
+	{0x1D167, 0x1D169, 0},
+	{0x1D17B, 0x1D182, 0},
+	{0x1D185, 0x1D18B, 0},
+	{0x1D1AA, 0x1D1AD, 0},
+	{0x1D242, 0x1D244, 0},
+	{0x1DA00, 0x1DA36, 0},
+	{0x1DA3B, 0x1DA6C, 0},
+	{0x1DA75, 0x1DA75, 0},
+	{0x1DA84, 0x1DA84, 0},
+	{0x1DA9B, 0x1E02A, 0},
+	{0x1E130, 0x1E136, 0},
+	{0x1E2EC, 0x1E2EF, 0},
+	{0x1E8D0, 0x1E8D6, 0},
+	{0x1E944, 0x1E94A, 0},
 	{0x1F004, 0x1F004, 2},
 	{0x1F0CF, 0x1F0CF, 2},
 	{0x1F18E, 0x1F18E, 2},
@@ -309,4 +410,5 @@ static const struct mbinterval wcwidth[] = {
 	{0x1FAD0, 0x1FAD6, 2},
 	{0x20000, 0x2FFFD, 2},
 	{0x30000, 0x3FFFD, 2},
+	{0xE0100, 0xE01EF, 0},
 };
-- 
2.31.1