File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @clack/prompts ' : patch
3+ ---
4+
5+ feat: adaptative max items
Original file line number Diff line number Diff line change 88 SelectKeyPrompt ,
99 SelectPrompt ,
1010 State ,
11- TextPrompt
11+ TextPrompt ,
1212} from '@clack/core' ;
1313import isUnicodeSupported from 'is-unicode-supported' ;
1414import color from 'picocolors' ;
@@ -69,7 +69,8 @@ const limitOptions = <TOption>(params: LimitOptionsParams<TOption>): string[] =>
6969 const { cursor, options, style } = params ;
7070
7171 // 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 ) ;
7374 let slidingWindowLocation = 0 ;
7475
7576 if ( cursor >= slidingWindowLocation + maxItems - 3 ) {
You can’t perform that action at this time.
0 commit comments