src: revise character width calculation · nodejs/node@98cb59e · GitHub
Skip to content

Commit 98cb59e

Browse files
TimothyGuaddaleax
authored andcommitted
src: revise character width calculation
- Categorize all nonspacing marks (Mn) and enclosing marks (Me) as 0-width - Categorize all spacing marks (Mc) as non-0-width. - Treat soft hyphens (a format character Cf) as non-0-width. - Do not treat all unassigned code points as 0-width; instead, let ICU select the default for that character per UAX #11. - Avoid getting the General_Category of a character multiple times as it is an intensive operation. Refs: http://unicode.org/reports/tr11/ PR-URL: #13918 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b4b27b2 commit 98cb59e

2 files changed

Lines changed: 54 additions & 5 deletions

File tree

src/node_i18n.cc

Lines changed: 23 additions & 4 deletions

test/parallel/test-icu-stringwidth.js

Lines changed: 31 additions & 1 deletion

0 commit comments

Comments
 (0)