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

Method goToLine

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

Source from the content-addressed store, hash-verified

995 }
996
997 goToLine(lineNumber: number): Cursor {
998 // Go to the beginning of the specified logical line (1-indexed, like vim)
999 // Uses logical lines (separated by \n), not wrapped display lines
1000 const lines = this.text.split('\n')
1001 const targetLine = Math.min(Math.max(0, lineNumber - 1), lines.length - 1)
1002 let offset = 0
1003 for (let i = 0; i < targetLine; i++) {
1004 offset += (lines[i]?.length ?? 0) + 1 // +1 for newline
1005 }
1006 return new Cursor(this.measuredText, offset, 0)
1007 }
1008
1009 endOfFile(): Cursor {
1010 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