[GH-ISSUE #299] Add "autocomplete" functionality to the InputField #226

Closed
opened 2026-03-04 01:03:09 +03:00 by kerem · 4 comments
Owner

Originally created by @mikeschinkel on GitHub (Jun 10, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/299

Hi @rivo:

See your comment on #77, which is closed, but you mentioned that you might possibly implement the autocomplete functionality you mentioned.

For my use-case I need to be able to present several items that users can choose from and either allow them to select one, or be able to enter a custom value. I have numerous fields that need this but one example is a software version number where I have a list of released version numbers but the user may actually be using a beta version where the version number is not released.

I am willing to (help) implement the autocomplete, as you have probably seen my recent flurry of PRs, but as that would be a bit more complex I would want input from you as to how you would prefer it to be implemented.

Originally created by @mikeschinkel on GitHub (Jun 10, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/299 Hi @rivo: See your [comment](/rivo/tview/issues/77#issuecomment-373462878) on #77, which is closed, but you mentioned that you might possibly implement the autocomplete functionality you mentioned. For my use-case I need to be able to present several items that users can choose from and **either** allow them to select one, or be able to enter a custom value. I have numerous fields that need this but one example is a software version number where I have a list of released version numbers but the user may actually be using a beta version where the version number is not released. I am willing to _(help)_ implement the autocomplete, as you have probably seen my recent flurry of PRs, but as that would be a bit more complex I would want input from you as to how you would prefer it to be implemented.
kerem closed this issue 2026-03-04 01:03:09 +03:00
Author
Owner

@diamondburned commented on GitHub (Jun 10, 2019):

Can be done by hacking in a List on top. I've done it.

<!-- gh-comment-id:500617760 --> @diamondburned commented on GitHub (Jun 10, 2019): Can be done by hacking in a List on top. I've done it.
Author
Owner

@mikeschinkel commented on GitHub (Jun 10, 2019):

@diamondburned Care to share (code?) :-)

<!-- gh-comment-id:500618071 --> @mikeschinkel commented on GitHub (Jun 10, 2019): @diamondburned Care to share _(code?)_ :-)
Author
Owner

@diamondburned commented on GitHub (Jun 11, 2019):

https://gitlab.com/diamondburned/6cord/blob/master/main.go#L266 is where I add things.

The rest of the logic is in fuzzy*.go

<!-- gh-comment-id:500678873 --> @diamondburned commented on GitHub (Jun 11, 2019): https://gitlab.com/diamondburned/6cord/blob/master/main.go#L266 is where I add things. The rest of the logic is in `fuzzy*.go`
Author
Owner

@rivo commented on GitHub (Jul 8, 2019):

Autocomplete functionality was requested earlier (#77) and I agree it's a useful addition to InputField. So I went ahead and added SetAutocompleteFunc() (along with Autocomplete()) to the InputField class.

There are two additional examples in the demos/inputfield directory which illustrates their usage. See the Wiki for an explanation.

<!-- gh-comment-id:509135745 --> @rivo commented on GitHub (Jul 8, 2019): Autocomplete functionality was requested earlier (#77) and I agree it's a useful addition to `InputField`. So I went ahead and added [`SetAutocompleteFunc()`](https://godoc.org/github.com/rivo/tview#InputField.SetAutocompleteFunc) (along with [`Autocomplete()`](https://godoc.org/github.com/rivo/tview#InputField.Autocomplete)) to the `InputField` class. There are two additional examples in the `demos/inputfield` directory which illustrates their usage. See the [`Wiki`](https://github.com/rivo/tview/wiki/InputField) for an explanation.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#226
No description provided.