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

Function isZeroWidth

source code/ink/stringWidth.ts:131–205  ·  view source on GitHub ↗
(codePoint: number)

Source from the content-addressed store, hash-verified

129}
130
131function isZeroWidth(codePoint: number): boolean {
132 // Fast path for common printable range
133 if (codePoint >= 0x20 && codePoint < 0x7f) return false
134 if (codePoint >= 0xa0 && codePoint < 0x0300) return codePoint === 0x00ad
135
136 // Control characters
137 if (codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f)) return true
138
139 // Zero-width and invisible characters
140 if (
141 (codePoint >= 0x200b && codePoint <= 0x200d) || // ZW space/joiner
142 codePoint === 0xfeff || // BOM
143 (codePoint >= 0x2060 && codePoint <= 0x2064) // Word joiner etc.
144 ) {
145 return true
146 }
147
148 // Variation selectors
149 if (
150 (codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
151 (codePoint >= 0xe0100 && codePoint <= 0xe01ef)
152 ) {
153 return true
154 }
155
156 // Combining diacritical marks
157 if (
158 (codePoint >= 0x0300 && codePoint <= 0x036f) ||
159 (codePoint >= 0x1ab0 && codePoint <= 0x1aff) ||
160 (codePoint >= 0x1dc0 && codePoint <= 0x1dff) ||
161 (codePoint >= 0x20d0 && codePoint <= 0x20ff) ||
162 (codePoint >= 0xfe20 && codePoint <= 0xfe2f)
163 ) {
164 return true
165 }
166
167 // Indic script combining marks (covers Devanagari through Malayalam)
168 if (codePoint >= 0x0900 && codePoint <= 0x0d4f) {
169 // Signs and vowel marks at start of each script block
170 const offset = codePoint & 0x7f
171 if (offset <= 0x03) return true // Signs at block start
172 if (offset >= 0x3a && offset <= 0x4f) return true // Vowel signs, virama
173 if (offset >= 0x51 && offset <= 0x57) return true // Stress signs
174 if (offset >= 0x62 && offset <= 0x63) return true // Vowel signs
175 }
176
177 // Thai/Lao combining marks
178 // Note: U+0E32 (SARA AA), U+0E33 (SARA AM), U+0EB2, U+0EB3 are spacing vowels (width 1), not combining marks
179 if (
180 codePoint === 0x0e31 || // Thai MAI HAN-AKAT
181 (codePoint >= 0x0e34 && codePoint <= 0x0e3a) || // Thai vowel signs (skip U+0E32, U+0E33)
182 (codePoint >= 0x0e47 && codePoint <= 0x0e4e) || // Thai vowel signs and marks
183 codePoint === 0x0eb1 || // Lao MAI KAN
184 (codePoint >= 0x0eb4 && codePoint <= 0x0ebc) || // Lao vowel signs (skip U+0EB2, U+0EB3)
185 (codePoint >= 0x0ec8 && codePoint <= 0x0ecd) // Lao tone marks
186 ) {
187 return true
188 }

Callers 1

stringWidthJavaScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected