-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(select): default value not being centered when not visible #59
Conversation
Good catch! Thanks for fixing it! Unfortunately, the issue still exists when the terminal height can't accommodate the configured It's not straightforward to solve, though. Currently, the renderer reduces the prompt's I'm working on a solution so that renderers can expose the number of lines they need to reserve, and then the prompt itself can adjust the |
Good catch too, I didn't even think about it! |
I've submitted #60, which makes sure the |
Thank you, I've updated my main branch and deleted the now useless |
Thanks! |
Somewhat related to this PR (and #58), I've just been playing around with showing how many items have been selected in a multi-select, which is especially helpful when they're not all on-screen. |
When you have a
select
prompt and set a default value outside the first x values (where x is defined by thescroll
parameter), you don't see it.It's even worst when you scroll down the list, since you'll never see what is currently selected, it'll remain outside of the displayed values until the end, when it loops back to the top.
This PR fixes this by centering the "view" (the displayed values) on the default item.
I had to modify the
select.php
playground in order to reflect this change.Before:
Recording.2023-09-08.093337.mp4
After:
Recording.2023-09-08.093456.mp4
...and when the default value is near the bottom of the list (in this example with a scroll 10):
Recording.2023-09-08.131053.mp4