All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beat Bolli <dev+git@drbeat.li>
To: git@vger.kernel.org
Cc: Beat Bolli <dev+git@drbeat.li>
Subject: [PATCH 3/3] unicode_width.h: fix the double_width[] table
Date: Sat,  3 Dec 2016 11:35:20 +0100	[thread overview]
Message-ID: <1480761320-27967-1-git-send-email-dev+git@drbeat.li> (raw)
In-Reply-To: <1480713995-16157-1-git-send-email-dev+git@drbeat.li>

The function bisearch() in utf8.c does a pure binary search in
double_width. It does not care about the 17 plane offsets which
unicode/uniset/uniset prepends. Leaving the plane offsets in the table
may cause wrong results.

Filter out the plane offsets in the update-unicode.sh and regenerate
the table.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 unicode_width.h   | 17 -----------------
 update_unicode.sh |  2 +-
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/unicode_width.h b/unicode_width.h
index 73b5fd6..02207be 100644
--- a/unicode_width.h
+++ b/unicode_width.h
@@ -297,23 +297,6 @@ static const struct interval zero_width[] = {
 { 0xE0100, 0xE01EF }
 };
 static const struct interval double_width[] = {
-{ /* plane */ 0x0, 0x3D },
-{ /* plane */ 0x3D, 0x68 },
-{ /* plane */ 0x68, 0x69 },
-{ /* plane */ 0x69, 0x6A },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
-{ /* plane */ 0x0, 0x0 },
 { 0x1100, 0x115F },
 { 0x231A, 0x231B },
 { 0x2329, 0x232A },
diff --git a/update_unicode.sh b/update_unicode.sh
index 3c84270..4c1ec8d 100755
--- a/update_unicode.sh
+++ b/update_unicode.sh
@@ -30,7 +30,7 @@ fi &&
 		  grep -v plane)
 	};
 	static const struct interval double_width[] = {
-		$(uniset/uniset --32 eaw:F,W)
+		$(uniset/uniset --32 eaw:F,W | grep -v plane)
 	};
 	EOF
 )
-- 
2.7.2

  parent reply	other threads:[~2016-12-03 10:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 21:26 [PATCH 1/2] update-unicode.sh: automatically download newer definition files Beat Bolli
2016-12-02 21:26 ` [PATCH 2/2] unicode: update the tables to Unicode 9.0 Beat Bolli
2016-12-03 10:35 ` Beat Bolli [this message]
2016-12-03 10:53 ` [PATCH v2 1/3] update-unicode.sh: automatically download newer definition files Beat Bolli
2016-12-03 10:53   ` [PATCH v2 2/3] unicode_width.h: update the tables to Unicode 9.0 Beat Bolli
2016-12-03 10:53   ` [PATCH v2 3/3] unicode_width.h: fix the double_width[] table Beat Bolli
2016-12-03 13:19     ` [PATCH v3 1/3] update-unicode.sh: automatically download newer definition files Beat Bolli
2016-12-03 13:19       ` [PATCH v3 2/3] update-unicode.sh: strip the plane offsets from the double_width[] table Beat Bolli
2016-12-03 13:19       ` [PATCH v3 3/3] unicode_width.h: update the tables to Unicode 9.0 Beat Bolli
2016-12-03 16:40       ` [PATCH v3 1/3] update-unicode.sh: automatically download newer definition files Torsten =?unknown-8bit?Q?B=C3=B6gershausen?=
2016-12-03 16:41         ` Beat Bolli
2016-12-03 21:00           ` [PATCH v4 " Beat Bolli
2016-12-03 21:00             ` [PATCH v4 2/3] update-unicode.sh: strip the plane offsets from the double_width[] table Beat Bolli
2016-12-03 21:00             ` [PATCH v4 3/3] unicode_width.h: update the tables to Unicode 9.0 Beat Bolli
2016-12-04  7:58             ` [PATCH v4 1/3] update-unicode.sh: automatically download newer definition files Torsten Bögershausen
2016-12-05 20:31               ` Junio C Hamano
2016-12-07  0:17                 ` Beat Bolli
2016-12-07  1:00                   ` jbh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480761320-27967-1-git-send-email-dev+git@drbeat.li \
    --to=dev+git@drbeat.li \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.