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 choose filtering #173

Open
PJGaetan opened this issue Mar 19, 2024 · 1 comment
Open

Select choose filtering #173

PJGaetan opened this issue Mar 19, 2024 · 1 comment

Comments

@PJGaetan
Copy link
Contributor

I am looking into Select, and right now by default, filtering is false on startup.

return &Select[T]{
	options:   []Option[T]{},
	value:     new(T),
	validate:  func(T) error { return nil },
	filtering: false,
	filter:    filter,
	theme:     ThemeCharm(),
}

I'm trying to get a user experience where the select is a filter mode when Run starts.

I wonder if there is a way to do so already, but I did not find how to override the filtering parameter before rendering the prompt.

I have in mind something like this, to a stay in line with what exist already.

func (s *Select[T]) Filtering(filtering bool) *Select[T] {
	s.filtering = filtering
	return s
}

Happy to contribute, if this is something you would welcome.

@maaslalani
Copy link
Member

Hey! @PJGaetan This makes sense to me! We'll just need to make sure the s.filter textinput gets focused as well, this should be done on Update if the s.filtering is true but s.filter.Focused is false.

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

No branches or pull requests

2 participants