Skip to content
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

[bug] issues when rendering a select whose items are longer than the active terminal viewport #64

Open
cylewitruk opened this issue Aug 1, 2024 · 3 comments · May be fixed by #83
Open

Comments

@cylewitruk
Copy link
Contributor

cylewitruk commented Aug 1, 2024

Just ran into this for the first time -- seems that if the select is long, your cursor will be placed at the bottom while the first selected item is at the top, outside of the active terminal. If you scroll up to see the active item and then press "down" to the next item, it will indeed select the correct item, but the entire list will be re-rendered and the cursor placed again at the bottom. Once the active item comes into the viewport, then it navigates correctly; the issue seems to be when the active item is outside of the viewport.

Hard to explain, easiest reproduced by creating a select with enough items to overflow the active terminal viewport and pressing buttons 😅

Here's a gif:
cliclack_long_select

One thing that would be nice here is to be able to specify a maximum size for the select, i.e. max height 5 lines and then scrolling the items when navigating up/down. In my example above, I don't really want my user's terminal to be spammed with all possible bitcoin core versions, it's most likely one of the most recent versions they're interested in, but I don't want to deny them older versions either. So only displaying i.e. the 5 most recent versions at first would be a benefit.

Not quite sure how to implement this if I were to take a stab at it...

@cylewitruk cylewitruk changed the title [bug] issues when rendering a select whose items are longer than the active terminal window [bug] issues when rendering a select whose items are longer than the active terminal viewport Aug 1, 2024
@fadeevab
Copy link
Owner

fadeevab commented Aug 1, 2024

@cylewitruk What a nasty bug :) Most likely, this one is gonna be tricky to fix, but let's see.

@cylewitruk
Copy link
Contributor Author

@fadeevab For now I've just limited the select to the 5 most recent versions as I think that's the 98% use-case, so no rush, but yeah this is something that should be looked into anyway :) If I get some free time I'll play around with it.

@BjornTheProgrammer
Copy link

I've just submitted pull request #83, which should fix this issue.

@BjornTheProgrammer BjornTheProgrammer linked a pull request Oct 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants