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

Limit the number of visible options in fuzzy select #134

Closed
garrettmaring opened this issue Sep 17, 2021 · 9 comments · Fixed by #162
Closed

Limit the number of visible options in fuzzy select #134

garrettmaring opened this issue Sep 17, 2021 · 9 comments · Fixed by #162
Labels
p-fuzzy-select Prompt: Fuzzy Select

Comments

@garrettmaring
Copy link

it would be great to have some sort of pagination when using FuzzySelect with many (100-1000s) of items

@pksunkara
Copy link
Collaborator

FuzzySelect uses search text to filter items. You shouldn't need pagination.

@garrettmaring
Copy link
Author

well, fuzzy style searching is very useful for very large collections. when using FuzzySelect with many items, the CLI is pushed "up" inside the terminal and it is rather unwieldy.

it'd be a fairly clean UI to be able to have paginated results / list (say 100 items match the fuzzy input after a few characters) to be able to navigate larger lists in addition to searching for them.

@garrettmaring
Copy link
Author

Hey @pksunkara 🖖 I want to clarify what I'm seeing visually when using FuzzySelect with a large collection of items. Maybe there is another fix better than pagination.

the top prompt is pushed off screen
Screen Shot 2021-10-22 at 10 12 00 AM

becomes visible again when < # lines of screen
Screen Shot 2021-10-22 at 10 10 44 AM

Is there a way to ensure that the list is "top aligned" so that the prompt is always visible?

@pksunkara
Copy link
Collaborator

Let me paste what I said in #143.

Fuzzy select should not have paging. What we can do is only show a few lines which signify the top results instead of showing all the options.

So, in the above scenario, fuzzy select should never display all options. It should display only K options where K = # of lines in terminal - 1.

I will edit this issue title to represent that instead of talking about paging.

@pksunkara pksunkara reopened this Oct 24, 2021
@pksunkara pksunkara changed the title add pagination to FuzzySelect Limit the number of visible options in fuzzy select Oct 24, 2021
@pksunkara pksunkara added the p-fuzzy-select Prompt: Fuzzy Select label Nov 23, 2021
@danieleades
Copy link
Contributor

Fuzzy select should not have paging.

Why is this?

@pksunkara
Copy link
Collaborator

Because that is what fuzzy searching means? It's kind of like an autocomplete. Where the suggestions show up to fill the place instead of just showing all the options available. Please correct me if I am mistaken.

@danieleades
Copy link
Contributor

Because that is what fuzzy searching means? It's kind of like an autocomplete. Where the suggestions show up to fill the place instead of just showing all the options available. Please correct me if I am mistaken.

i thought the use case described above was reasonably compelling. namely that at an intermediate search stage, when filtering has been applied, but there are still a large number of entries, being able to scroll through the list could be preferable to having to continue to extend the search term. For example, you might search a prefix representing a collection of objects without necessarily knowing the members of that set.

But i'm speculating. I don't have a particular use-case in mind. Do you lose any other functionality by enabling paging for the fuzzy search? is there a cost associated with this?

@pksunkara
Copy link
Collaborator

I don't mind implementing paging in fuzzy_select but I don't see how it is possible without overcomplicating the keypress semantics in the lib.

If you look at Select prompt here, we the right and left arrow keys to change pages.

If you look at FuzzySelect prompt here, we use them to move on the input line (similar to how Input prompt behaves)

@danieleades
Copy link
Contributor

That makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p-fuzzy-select Prompt: Fuzzy Select
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants