Changing auto-complete behaviour
Hello,
I'm interested in changing the auto-complete behaviour to make it act more like Linux.
Right now, I have two commands state and status. If I type s and hit tab, it just autocompletes to whichever is first in the StaticAutoComplete object. What I would instead like to have happen is the following:
s <tab>
Autocompletes to stat
<tab> again does nothing
<tab again> lists state status
I hope that makes sense. It's identical behaviour to how my Linux machine operates(bash).
If this behaviour seems like something you'd want, I'm happy to implement it. Just trying to figure out what the Autocomplete trait should look like.
pub trait Autocomplete {
fn suggest<FO: FnOnce(&str), FM: Fn(&str)>(&self, prefix: &str, one: FO, many: FM);
}
The idea is, you call one if there's a single result, or many if there's more than one result (calling both would be an error). many you'd call once per result. Seems like the most memory-efficient way to do it - even more efficient than the current trait, since it doesn't require instantiating a String<CMD_LEN>