bubbles
bubbles copied to clipboard
Activate filtering programmatically
Problem
I'm looking to enable filtering for my github.com/charmbracelet/bubbles/list
component by default so that as soon as the list is rendered I can start to type, without needing to press the filter shortcut (/
) first.
Recreate
- Use the
list-default
example within the charmbracelet/bubbletea repo - Set
m.list.SetFilteringEnabled(true)
on line 82 - Note that this does not do anything
I'm relatively new to the package so I think this needs to be done at a different point within the model lifecycle, rather than at the point of creation. Any help would be great 👍
Hi! SetFilteringEnabled is actually for enabling and disabling filter functionality, not quite for triggering filtering. Based on my quick skimming of the code think we’ll need to add a method for you to be able to activate the filter programmatically.
Anyway, it’s a good idea, and we should definitely add it (surprised we haven’t, actually), though it will probably happen after the new year.
@meowgorithm Any update around this?
I am facing the same issue. I just want to view filter input with a different key msg and use it for another purpose rather than filtering. But no way to achieve this. m.list.SetShowFilter() doesn't work and does not replace title. Any news on this issue?
Same thoughts as @akgunberk: I would ideally just want to co-opt the same screen space the filtering currently takes up, but activate it with a different key and then just capture the input without any filtering.