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

Function calculateNewCursorPosition

cli/src/utils/word-wrap-utils.ts:37–53  ·  view source on GitHub ↗
(params: {
  cursorPosition: number
  lineStarts: number[]
  cursorIsChar: boolean
  direction: 'up' | 'down'
  desiredIndex: number
})

Source from the content-addressed store, hash-verified

35}
36
37export function calculateNewCursorPosition(params: {
38 cursorPosition: number
39 lineStarts: number[]
40 cursorIsChar: boolean
41 direction: 'up' | 'down'
42 desiredIndex: number
43}): number {
44 const { direction } = params
45 if (direction === 'up') {
46 return cursorUp(params)
47 }
48 if (direction === 'down') {
49 return cursorDown(params)
50 }
51 direction satisfies never
52 throw new Error(`Invalid direction: ${direction}`)
53}

Callers 1

Calls 2

cursorUpFunction · 0.85
cursorDownFunction · 0.85

Tested by

no test coverage detected