[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started/
cli command-line command-line-app node prompt prompts
5

Configure Feed

Select the types of activity you want to include in your feed.

feat: adaptative max items

Bruno Rocha (Oct 4, 2023, 9:02 AM -0300) 360afeb0 90f8e3d7

+8 -2
+5
.changeset/light-laws-judge.md
··· 1 + --- 2 + '@clack/prompts': patch 3 + --- 4 + 5 + feat: adaptative max items
+3 -2
packages/prompts/src/index.ts
··· 8 8 SelectKeyPrompt, 9 9 SelectPrompt, 10 10 State, 11 - TextPrompt 11 + TextPrompt, 12 12 } from '@clack/core'; 13 13 import isUnicodeSupported from 'is-unicode-supported'; 14 14 import color from 'picocolors'; ··· 69 69 const { cursor, options, style } = params; 70 70 71 71 // We clamp to minimum 5 because anything less doesn't make sense UX wise 72 - const maxItems = params.maxItems === undefined ? Infinity : Math.max(params.maxItems, 5); 72 + const maxItems = 73 + params.maxItems === undefined ? process.stdout.rows - 4 : Math.max(params.maxItems, 5); 73 74 let slidingWindowLocation = 0; 74 75 75 76 if (cursor >= slidingWindowLocation + maxItems - 3) {