huh icon indicating copy to clipboard operation
huh copied to clipboard

Select choose filtering

Open PJGaetan opened this issue 1 year ago • 1 comments

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.

PJGaetan avatar Mar 19 '24 23:03 PJGaetan

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.

maaslalani avatar Apr 04 '24 19:04 maaslalani