From 023011bdbe7b67cd4a5134325d2d642270e94a9b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 1 Aug 2022 01:31:01 -0400 Subject: [PATCH] Adds extra length check for perf --- src/system/string.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/string.ts b/src/system/string.ts index c2e8965..95f19eb 100644 --- a/src/system/string.ts +++ b/src/system/string.ts @@ -405,6 +405,8 @@ export function getWidth(s: string): number { } s = s.replace(cachedAnsiRegex, ''); + if (s.length === 0) return 0; + let count = 0; let emoji = 0; let joiners = 0;