From b9abbc0a85ec17b73d0808a3734c9df24909e106 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Mon, 7 Aug 2023 11:10:06 -0700 Subject: [PATCH] Split complicated conditional expression. --- .../src/UnicodeGraphemeProvider.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts index 09a7f25e..06987c18 100644 --- a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts +++ b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts @@ -53,7 +53,12 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider { const charInfo = UC.getInfo(codepoint); const w = UC.infoToWidthInfo(charInfo); const kind = (charInfo & UC.GRAPHEME_BREAK_MASK) >> UC.GRAPHEME_BREAK_SHIFT; - return (kind === UC.GRAPHEME_BREAK_Extend || kind === UC.GRAPHEME_BREAK_Prepend) ? 0 - : (w >= 2 && (w === 3 || this.ambiguousCharsAreWide)) ? 2 : 1; + if (kind === UC.GRAPHEME_BREAK_Extend || kind === UC.GRAPHEME_BREAK_Prepend) { + return 0; + } + if (w >= 2 && (w === 3 || this.ambiguousCharsAreWide)) { + return 2; + } + return 1; } }