mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #471] autocomplete doesn't work for single matches #340
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#340
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @khughitt on GitHub (Jul 17, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/471
Overview
Greetings!
I'm just doing some experimenting with the autocomplete example from the wiki.
While it works quite well when there are >1 matches for the given input, single matches appear to be completely left out.
Example
Ex. (modified version of
autocomplete.gofrom the Wiki):Observed behavior
To be consistent with how autocompletion behaves in other software (zsh, web browsers, etc.), would it be possible to modify the behavior such that:
Also, unrelated, but do you think it would be in the desired scope of tview to add support for fzf-style fuzzy input matching in the future? That would be pretty amazing to have support for out-of-the box. If so, I can file a separate issue to keep track of it.
Thanks for all your work on this great library!
System info
@rivo commented on GitHub (Sep 15, 2020):
I think
tviewalready does what you're asking it to do. Points (1) and (2) are due to this part in your code:That's why it's not showing anything when you only enter one character.
Also, you may choose to show all autocomplete items if you just return them. For example:
I don't have any plans to implement fuzzy matching. But the way the autocomplete functionality is implemented here is that users do the matching themselves.
tviewdoesn't match any input. They're free to use any algorithm they wish.Let me know if this answers your questions.
@khughitt commented on GitHub (Sep 15, 2020):
@rivo Thanks for taking the time to respond to this issue, and for the suggestions/clarifications!
That helps clear everything up! I should have noticed the
len(entries)check.As you suggested, I was also able to get fuzzy matching working using [github.com/sahilm/fuzzy](https://github.com/sahilm/fuzzy].