Files
torlink/src/ui/move.ts
T
bairon.dev 60d7a9a755 feat: terminal-native torrent discovery TUI
Curated, multi-source torrent search and download from the terminal:
concurrent search across built-in sources with streamed, source-tagged
results; a download-only webtorrent engine with true pause/resume and
restart recovery; magnet paste; and a calm Ink + React TUI. No indexer
server, no setup.
2026-06-27 02:03:19 -04:00

11 lines
396 B
TypeScript

export function wrapStep(current: number, delta: number, length: number): number {
if (length <= 0) return 0;
return (((current + delta) % length) + length) % length;
}
export function windowStart(cursor: number, total: number, height: number): number {
if (total <= height) return 0;
const half = Math.floor(height / 2);
return Math.max(0, Math.min(cursor - half, total - height));
}