MCPcopy Create free account
hub / github.com/Effect-TS/effect / entriesToDisplay

Function entriesToDisplay

packages/cli/src/internal/prompt/utils.ts:2–10  ·  view source on GitHub ↗
(cursor: number, total: number, maxVisible?: number)

Source from the content-addressed store, hash-verified

1/** @internal */
2export const entriesToDisplay = (cursor: number, total: number, maxVisible?: number) => {
3 const max = maxVisible === undefined ? total : maxVisible
4 let startIndex = Math.min(total - max, cursor - Math.floor(max / 2))
5 if (startIndex < 0) {
6 startIndex = 0
7 }
8 const endIndex = Math.min(startIndex + max, total)
9 return { startIndex, endIndex }
10}

Callers 3

renderChoicesFunction · 0.85
renderFilesFunction · 0.85
renderChoicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected