Skip to content

Commit

Permalink
Include ASCII characters in "na" table
Browse files Browse the repository at this point in the history
Since we're now assigning "na" (narrow) characters width 1,
we can include the ASCII character ranges in the table.
  • Loading branch information
wedaly committed Aug 14, 2020
1 parent 1e492b2 commit e7278bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion runewidth_table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion runewidth_test.go
Expand Up @@ -44,7 +44,7 @@ var tables = []tableInfo{
{doublewidth, "doublewidth", 182440, "3d16eda8650dc2c92d6318d32f0b4a74fda5a278db2d4544b1dd65863394823c"},
{ambiguous, "ambiguous", 138739, "d05e339a10f296de6547ff3d6c5aee32f627f6555477afebd4a3b7e3cf74c9e3"},
{emoji, "emoji", 3535, "9ec17351601d49c535658de8d129c1d0ccda2e620669fc39a2faaee7dedcef6d"},
{narrow, "narrow", 10, "68441e98eca1450efbe857ac051fcc872eed347054dfd0bc662d1c4ee021d69f"},
{narrow, "narrow", 111, "fa897699c5e3cd9141c638d539331b0bdd508b874e22996c5e929767d455fc5a"},
{neutral, "neutral", 27333, "5455f5e75c307f70b4e9b2384dc5a8bcd91a4c5e2b24b2b185dfad4d860ee5c2"},
}

Expand Down Expand Up @@ -164,6 +164,7 @@ var runewidthtests = []struct {
{'\u0300', 0, 0},
{'\u2028', 0, 0},
{'\u2029', 0, 0},
{'a', 1, 1}, // ASCII classified as "na" (narrow)
{'⟦', 1, 1}, // non-ASCII classified as "na" (narrow)
}

Expand Down
10 changes: 4 additions & 6 deletions script/generate.go
Expand Up @@ -92,12 +92,10 @@ func eastasian(out io.Writer, in io.Reader) error {
hi: r2,
})
case "Na":
if r1 > 0xFF {
na = append(na, rrange{
lo: r1,
hi: r2,
})
}
na = append(na, rrange{
lo: r1,
hi: r2,
})
case "N":
nu = append(nu, rrange{
lo: r1,
Expand Down

0 comments on commit e7278bc

Please sign in to comment.