Skip to content

Commit 987c927

Browse files
BridgeARcodebytere
authored andcommitted
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 <[email protected]> PR-URL: #33650 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 91d0d53 commit 987c927

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/internal/util/inspect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ if (internalBinding('config').hasIntl) {
20562056

20572057
const isZeroWidthCodePoint = (code) => {
20582058
return code <= 0x1F || // C0 control codes
2059-
(code > 0x7F && code <= 0x9F) || // C1 control codes
2059+
(code >= 0x7F && code <= 0x9F) || // C1 control codes
20602060
(code >= 0x300 && code <= 0x36F) || // Combining Diacritical Marks
20612061
(code >= 0x200B && code <= 0x200F) || // Modifying Invisible Characters
20622062
// Combining Diacritical Marks for Symbols

test/parallel/test-icu-stringwidth.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
'use strict';
33
const common = require('../common');
44

5-
if (!common.hasIntl)
6-
common.skip('missing Intl');
7-
85
const assert = require('assert');
96
const { getStringWidth } = require('internal/util/inspect');
107

@@ -88,7 +85,7 @@ for (let i = 0; i < 256; i++) {
8885
}
8986
}
9087

91-
{
88+
if (common.hasIntl) {
9289
const a = '한글'.normalize('NFD'); // 한글
9390
const b = '한글'.normalize('NFC'); // 한글
9491
assert.strictEqual(a.length, 6);

0 commit comments

Comments
 (0)