MCPcopy Index your code
hub / github.com/codeaashu/claude-code / needsSegmentation

Function needsSegmentation

src/ink/stringWidth.ts:92–104  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

90}
91
92function needsSegmentation(str: string): boolean {
93 for (const char of str) {
94 const cp = char.codePointAt(0)!
95 // Emoji ranges
96 if (cp >= 0x1f300 && cp <= 0x1faff) return true
97 if (cp >= 0x2600 && cp <= 0x27bf) return true
98 if (cp >= 0x1f1e6 && cp <= 0x1f1ff) return true
99 // Variation selectors, ZWJ
100 if (cp >= 0xfe00 && cp <= 0xfe0f) return true
101 if (cp === 0x200d) return true
102 }
103 return false
104}
105
106function getEmojiWidth(grapheme: string): number {
107 // Regional indicators: single = 1, pair = 2

Callers 1

stringWidthJavaScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected