mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
util: fix width detection for DEL without ICU
This makes sure the DEL character (ASCII 127) is detected as a zero width character even if Node.js is not built with ICU. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> PR-URL: https://github.com/nodejs/node/pull/33650 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
9d9c15a5c3
commit
677dce13e7
2 files changed
+2
-5
No files matched your search
@@ -2047,7 +2047,7 @@ if (internalBinding('config').hasIntl) {
|
||||
|
||||
const isZeroWidthCodePoint = (code) => {
|
||||
return code <= 0x1F || // C0 control codes
|
||||
(code > 0x7F && code <= 0x9F) || // C1 control codes
|
||||
(code >= 0x7F && code <= 0x9F) || // C1 control codes
|
||||
(code >= 0x300 && code <= 0x36F) || // Combining Diacritical Marks
|
||||
(code >= 0x200B && code <= 0x200F) || // Modifying Invisible Characters
|
||||
// Combining Diacritical Marks for Symbols
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasIntl)
|
||||
common.skip('missing Intl');
|
||||
|
||||
const assert = require('assert');
|
||||
const { getStringWidth } = require('internal/util/inspect');
|
||||
|
||||
@@ -88,7 +85,7 @@ for (let i = 0; i < 256; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (common.hasIntl) {
|
||||
const a = '한글'.normalize('NFD'); // 한글
|
||||
const b = '한글'.normalize('NFC'); // 한글
|
||||
assert.strictEqual(a.length, 6);
|
||||
|
||||
Reference in new issue
Block a user