charmbracelet / bubbles

TUI components for Bubble Tea 🫧

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List: Initializing the list Model to be used in filtering mode directly

lorenzo-milicia opened this issue · comments

Hi everyone, this is my first ever Issue raised, hopefully I'm not breaking any guidelines.
I am using Bubbles and Bubbletea to write a small utility CLI tool, after experimenting a bit with gum. But I can't seem to figure out if there is a way to use the list component directly as a filtering tool.
My use case would be to simply initialize the list component to already be (and potentially ONLY be) set up for filtering.
I tried looking at the code, and I don't see any public method to manipulate the FilterState outside of the KeyMsg. I tried implementing it myself on a fork, and it seems to be straight forward, all I did was expose a public method to set the FilterState of the model.
Adding on that, although this might be just a matter of personal like, I find it a bit annoying to not be able to move the list cursor up and down while being in the Filtering mode. I can't think of any actual use of the up and down arrow keys in filtering mode, so I want to ask if there's a specific reason why the up and down keys are mapped to CancelWhileFiltering.
If these improvements could be something worth implementing, I would be more than glad to give it a try myself and open a Pull Request.

I tried implementing it myself on a fork, and it seems to be straight forward, all I did was expose a public method to set the FilterState of the model.

Yeh I'd be interested in that API! Tried to do this myself also. Thanks!

PR already cut over in #335 it seems!