Skip to content

NewSelect OptionsFunc cursor is static while options move #724

@kevmul

Description

@kevmul

Description

When creating a NewSelect with normal Options, I am able to display all my items while the cursor on the left moves up and down between them. The options are static. This is great.

When I create the same form with OptionsFunc the cursor becomes static and the options scroll up and down. This pushes the top options out of the view port.

// Here is the working Options way
huh.NewSelect[string](). 
    Title("Option Working List").
    Options(
        huh.NewOption("One", "one"),
        huh.NewOption("Two", "two"),
        huh.NewOption("Three", "three"),
  )
Image

As you can see in the image, the second option ("Two") is selected and "One" is still visible.

huh.NewSelect[string]().
	Title("OptionFunc Not working List").
	OptionsFunc(func() []huh.Option[string] {
		return huh.NewOptions("One", "Two", "Three") // For simplicity
	}, "option").
Image

Image to show all three are displaying.

Image

Now we select the second option, and the first option ("One") is out of the viewport.

Also note that for all of this I have set and unset the .Height(10) to test out if the viewport wasn't tall enough. This had no affect on the rendering issues.

Version

v0.8.0

Environment

Mac Arm (M1 pro) OS Sequoia 15.6.1 / Ghostty & Wezterm & iTerm2 / Tmux & without

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions