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

Filter search not working in list-simple example #155

Closed
souvikinator opened this issue Nov 9, 2021 · 5 comments
Closed

Filter search not working in list-simple example #155

souvikinator opened this issue Nov 9, 2021 · 5 comments

Comments

@souvikinator
Copy link

souvikinator commented Nov 9, 2021

After running the example list-simple/main.go I noticed that the search function is not getting triggered.

I see the FilterValue() is also defined just like in other list examples.

Not sure if this is the default behavior or some issue.

Edit

l.SetFilteringEnabled(true) setting this to true enables the search but now the issue is it shows nothing in the search like so:

issue-bubble

@jon4hz
Copy link
Contributor

jon4hz commented Nov 9, 2021

FilterValue() must be defined in order to satisfy the Item interface defined here. For the filter to work properly, you'll have to update the list model if you receive a list.filterMatchesMsg tea command. Since this is a private struct, you have to catch the cmd in the default case.

@meowgorithm
Copy link
Member

meowgorithm commented Nov 9, 2021

Hi! So the list example was actually intended to have filtering disabled, but it looks like we accidentally left some of the filtering hooks in. We’ll remove it to keep the simple example simple.

That said, here is the simple list example with filtering enabled and here is the diff with the necessary changes. Basically, you just need to make sure the enter doesn't select an item while filtering and then you just need to make sure all messages pass through list’s Update function so filter matching messages will be processed.

On that note (and to your point, @jon4hz) list.filterMatchesMsg should probably be exposed so people can match on that message.


Edit: whoops, I totally missed your PR there, @jon4hz. That’s also a great example of how to do it.

@souvikinator
Copy link
Author

Hey there! thanks for clarifying. So I was trying to update the list contents in View rather than Update. Now it's working, thanks for pointing out :)

@jon4hz
Copy link
Contributor

jon4hz commented Nov 9, 2021

@meowgorithm if you want filtered disabled in the simple-list example I'll close my PR. Exposing list.filterMatchesMsg is imo a cool idea.

@muesli
Copy link
Member

muesli commented Oct 6, 2022

Can't reproduce this anymore, the filter tooltip isn't showing up in list-simple. Thanks for the ticket, closing!

@muesli muesli closed this as completed Oct 6, 2022
lorenzo-milicia pushed a commit to lorenzo-milicia/bubbles that referenced this issue Mar 5, 2023
* feat: allow to set the height of the item

The user might want to show more than 2 lines, and, right now, if they
try to do so, things break.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: short-circuit if width <= 0

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: height check

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
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

Successfully merging a pull request may close this issue.

4 participants