-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Describe the bug
If I create a select field with a long list of options (bigger than the viewport) it becomes scrollable.
But if I pre-select an option that is not in the first viewport page I can't see the cursor.
To Reproduce
Steps to reproduce the behavior:
- create a select field with a long list (ie: 50 options)
- pre-select an option down the list (ie: position 30)
- run
Source Code
package main
import (
"github.com/charmbracelet/huh"
)
func main() {
country := "PT"
x := huh.NewSelect[string]().
Title("Pick a country.").
Options(
huh.NewOption("United States", "US"),
huh.NewOption("Germany", "DE"),
huh.NewOption("Brazil", "BR"),
huh.NewOption("Canada", "CA"),
huh.NewOption("Spain", "ES"),
huh.NewOption("Portugal", "PT"), // outside of initial viewport
huh.NewOption("Italy", "IT"),
huh.NewOption("Germany", "DE"),
).
Height(5). // small viewport
Value(&country) // pre-select an option below the viewport bottom
x.Run()
}
Expected behavior
I expect the viewport to show the cursor on the selected option
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels