MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / findLineStart

Function findLineStart

cli/src/components/multiline-input.tsx:46–52  ·  view source on GitHub ↗
(text: string, cursor: number)

Source from the content-addressed store, hash-verified

44
45// Helper functions for text manipulation
46function findLineStart(text: string, cursor: number): number {
47 let pos = Math.max(0, Math.min(cursor, text.length))
48 while (pos > 0 && text[pos - 1] !== '\n') {
49 pos--
50 }
51 return pos
52}
53
54function findLineEnd(text: string, cursor: number): number {
55 let pos = Math.max(0, Math.min(cursor, text.length))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected