MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / stringIndexToDisplayWidth

Method stringIndexToDisplayWidth

src/utils/Cursor.ts:1208–1212  ·  view source on GitHub ↗
(text: string, index: number)

Source from the content-addressed store, hash-verified

1206
1207 // Convert string index to display width
1208 public stringIndexToDisplayWidth(text: string, index: number): number {
1209 if (index <= 0) return 0
1210 if (index >= text.length) return stringWidth(text)
1211 return stringWidth(text.substring(0, index))
1212 }
1213
1214 // Convert display width to string index
1215 public displayWidthToStringIndex(text: string, targetWidth: number): number {

Callers 1

getPositionFromOffsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected