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

Select options disappear when other options wrap #429

Open
seeseemelk opened this issue Oct 18, 2024 · 3 comments · May be fixed by #485
Open

Select options disappear when other options wrap #429

seeseemelk opened this issue Oct 18, 2024 · 3 comments · May be fixed by #485
Labels
bug Something isn't working select

Comments

@seeseemelk
Copy link

seeseemelk commented Oct 18, 2024

Describe the bug
When showing a Select menu, the last option disappears when at least two options have to wrap

To Reproduce
Steps to reproduce the behavior:

  1. Create a select with at least three (long) options
  2. Make your terminal small enough so that two options have to wrap
  3. See the last one disappear

Expected behavior
All possible options should stay visible.

Screenshots
No wrapping, all options are visible:
Screenshot_2024-10-18_07-51-19

One option wraps, all options are visible:
Screenshot_2024-10-18_07-51-29

Two options wrap, the last option disappears:
Screenshot_2024-10-18_07-51-42

Desktop (please complete the following information):

  • OS: Linux dalek 6.11.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 10 Oct 2024 20:11:06 +0000 x86_64 GNU/Linux
  • Terminal: alacritty, cool retro term, urxvt
  • Version [e.g. 22]
@seeseemelk
Copy link
Author

I've been looking into this a little: the select option hard-codes that it should scroll down a single line when pressing the down arrow key.
Changing this to, say, 2, helps a little, but does not actually fix it.

The Viewport class itself also seems to assume that lines don't wrap. It generates a slice of visible lines based on the viewport height and scroll position, but this slice does not take wrapping into account.

Likely, if the Viewport is modified so it correctly considers wrapping, the Select will probably just work

@bashbunni
Copy link
Member

I agree this is likely viewport not calculating height properly

@Kyren223
Copy link

Kyren223 commented Oct 24, 2024

@bashbunni It is, I independently also discovered it, there is an open issue at bubbles charmbracelet/bubbles#644

@caarlos0 caarlos0 added bug Something isn't working select labels Nov 26, 2024
@bashbunni bashbunni linked a pull request Nov 27, 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
bug Something isn't working select
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants