MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / needsSegmentation

Function needsSegmentation

source code/ink/stringWidth.ts:94–106  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

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

Callers 1

stringWidthJavaScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected