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

Method stringIndexToDisplayWidth

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

Source from the content-addressed store, hash-verified

1231
1232 // Convert string index to display width
1233 public stringIndexToDisplayWidth(text: string, index: number): number {
1234 if (index <= 0) return 0
1235 if (index >= text.length) return stringWidth(text)
1236 return stringWidth(text.substring(0, index))
1237 }
1238
1239 // Convert display width to string index
1240 public displayWidthToStringIndex(text: string, targetWidth: number): number {

Callers 1

getPositionFromOffsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected