Commit d4bc79b
authored
🧼 generate compact
* ref(wcwidth): generate efficient wcwidth tables
* ref(wcwidth): deslop
* perf(wcwidth): add BMP filter + fast path, use single table for binary search
* ref(ci): add verify task
* deno fmt
* ref(wcwidth): generate clang-format friendly code
* fix(verify): handle --check flag
* deno lint
* ref(wcwidth): add datahash
* ref(wcwidth): correctness pass
* ref(wcwidth): performance pass
* ref(wcwidth): upgrade to unicode 17
* ref(wcwidth): regen
* fix format
* fix(render): measure non-printable codepoints as one cell
The draw path coerces wcwidth() == -1 to one cell and emits U+FFFD, but
the Clay measure callback skipped those codepoints entirely, so a
fit-sized box around text containing a control character or
noncharacter measured narrower than what the renderer draws. Mirror
draw_text in measure(): coerce -1 to 1, and substitute U+FFFD on UTF-8
decode failure instead of passing an uninitialized codepoint to
wcwidth().
* fix(wcwidth): treat surrogates as non-printable
utf8_decode() accepts CESU-8 surrogate encodings, and the Unicode 17
tables default unlisted codepoints to width 1, so a surrogate reaching
draw_text was emitted to the terminal as invalid UTF-8 (the old
termbox2 table returned -1 for U+D800..U+DFFF and the emit path
sanitized it to U+FFFD). Guard the surrogate range in the generated
wcwidth() so iswprint() rejects it and the emit path substitutes
U+FFFD again.
Also derive the generated header's Unicode version from the same
constant as the data URL; it was left saying 16.0 after the 17.0
upgrade.wcwidth tables (#49)1 parent 917616b commit d4bc79b
6 files changed
Lines changed: 838 additions & 1106 deletions
File tree
- .github/workflows
- src
- tasks
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
| 859 | + | |
859 | 860 | | |
| 861 | + | |
| 862 | + | |
860 | 863 | | |
| 864 | + | |
| 865 | + | |
861 | 866 | | |
862 | 867 | | |
863 | 868 | | |
| |||
0 commit comments