diff options
author | John Naylor <john.naylor@postgresql.org> | 2022-09-13 16:13:33 +0700 |
---|---|---|
committer | John Naylor <john.naylor@postgresql.org> | 2022-09-13 16:13:33 +0700 |
commit | 0bd9c629732375e21d3ca6fba16c4a6a2808411a (patch) | |
tree | 1cdbc6743a69559f62755232d550a7fc9534731b /src/common/wchar.c | |
parent | bb629c294bea533884a379eee5f8ed6307c17bf2 (diff) | |
download | postgresql-0bd9c629732375e21d3ca6fba16c4a6a2808411a.tar.gz postgresql-0bd9c629732375e21d3ca6fba16c4a6a2808411a.zip |
Treat Unicode codepoints of category "Format" as non-spacing
Commit d8594d123 updated the list of non-spacing codepoints used
for calculating display width, but in doing so inadvertently removed
some, since the script used for that commit only considered combining
characters.
For complete coverage for zero-width characters, include codepoints in
the category Cf (Format). To reflect the wider purpose, also rename files
and update comments that referred specifically to combining characters.
Some of these ranges have been missing since v12, but due to lack of
field complaints it was determined not important enough to justify adding
special-case logic the backbranches.
Kyotaro Horiguchi
Report by Pavel Stehule
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBE8yvpQ0FSkPCoe0Ny1jAAsAQ6j3qMgVwWvkqAoaaNmQ%40mail.gmail.com
Diffstat (limited to 'src/common/wchar.c')
-rw-r--r-- | src/common/wchar.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/wchar.c b/src/common/wchar.c index fa8854d9e9f..3b3fc53009f 100644 --- a/src/common/wchar.c +++ b/src/common/wchar.c @@ -620,7 +620,7 @@ mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max) * value of -1. * * - Non-spacing and enclosing combining characters (general - * category code Mn or Me in the Unicode database) have a + * category code Mn, Me or Cf in the Unicode database) have a * column width of 0. * * - Spacing characters in the East Asian Wide (W) or East Asian @@ -638,7 +638,7 @@ mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max) static int ucs_wcwidth(pg_wchar ucs) { -#include "common/unicode_combining_table.h" +#include "common/unicode_nonspacing_table.h" #include "common/unicode_east_asian_fw_table.h" /* test for 8-bit control characters */ @@ -657,8 +657,8 @@ ucs_wcwidth(pg_wchar ucs) * factor for display width leads to the correct behavior, so do that * search first. */ - if (mbbisearch(ucs, combining, - sizeof(combining) / sizeof(struct mbinterval) - 1)) + if (mbbisearch(ucs, nonspacing, + sizeof(nonspacing) / sizeof(struct mbinterval) - 1)) return 0; /* binary search in table of wide characters */ |