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

Function graphemeWidth

src/ink/termio/parser.ts:63–69  ·  view source on GitHub ↗
(grapheme: string)

Source from the content-addressed store, hash-verified

61}
62
63function graphemeWidth(grapheme: string): 1 | 2 {
64 if (hasMultipleCodepoints(grapheme)) return 2
65 const codePoint = grapheme.codePointAt(0)
66 if (codePoint === undefined) return 1
67 if (isEmoji(codePoint) || isEastAsianWide(codePoint)) return 2
68 return 1
69}
70
71function* segmentGraphemes(str: string): Generator<Grapheme> {
72 for (const { segment } of getGraphemeSegmenter().segment(str)) {

Callers 1

segmentGraphemesFunction · 0.85

Calls 3

hasMultipleCodepointsFunction · 0.85
isEmojiFunction · 0.85
isEastAsianWideFunction · 0.85

Tested by

no test coverage detected