mirror of
https://github.com/baairon/torlink.git
synced 2026-07-08 18:28:22 +02:00
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.
11 lines
396 B
TypeScript
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));
|
|
}
|