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

Method goToLine

src/utils/Cursor.ts:1022–1032  ·  view source on GitHub ↗
(lineNumber: number)

Source from the content-addressed store, hash-verified

1020 }
1021
1022 goToLine(lineNumber: number): Cursor {
1023 // Go to the beginning of the specified logical line (1-indexed, like vim)
1024 // Uses logical lines (separated by \n), not wrapped display lines
1025 const lines = this.text.split('\n')
1026 const targetLine = Math.min(Math.max(0, lineNumber - 1), lines.length - 1)
1027 let offset = 0
1028 for (let i = 0; i < targetLine; i++) {
1029 offset += (lines[i]?.length ?? 0) + 1 // +1 for newline
1030 }
1031 return new Cursor(this.measuredText, offset, 0)
1032 }
1033
1034 endOfFile(): Cursor {
1035 return new Cursor(this.measuredText, this.text.length, 0)

Callers 3

executeOperatorGFunction · 0.80
executeOperatorGgFunction · 0.80
handleNormalInputFunction · 0.80

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected