-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add input autocompletion #39
Conversation
@@ -153,6 +162,7 @@ impl<'a> Input<'a> { | |||
return self.handle_submit(); | |||
} | |||
} | |||
Key::Tab => self.handle_tab()?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of huh
, the key Ctrl+E (End)
is used since Tab
is used to switch between the fields within a form. I find this a bit counter intuitive but if we choose to implement forms/groups (which seems non-trivial with that nasty cursor handling) we might also need to go that route.
prompt: "> ".to_string(), | ||
placeholder: String::new(), | ||
suggestions: vec![], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Vector
is a relatively naive approach, i wonder if this is worth adding a (e.g. Trie) dependency. Question is if we need support for an insanely large set of suggestions here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Played around with a Trie
implementation which is 100x faster but makes case insensistive matching impossible. Also with for example 5k name suggestions, names overlap that much that the suggestion would only suggest the next character.
fb4b820
to
b8cb1ff
Compare
b8cb1ff
to
dc40caf
Compare
Adding a 'suggestions' property to allow for autocompletion of the input. We might open a separate issue for more specialized 'file-picker' implementation.