Implement substring autocompletion for /msg
People with huge contact lists most likely happen to have contacts starting with popular names more often. They can use /msg Arthur to find the correct person.
But if they have 50 Arthurs it will take a while. Using the surname might be faster. So a substring search of /msg Clarke
Fix https://github.com/profanity-im/profanity/issues/1984
roster_contact_autocomplete() is used for:
- /msg
- /info
- /roster remvoe
- /roster group add
- /roster group remove
- /otr policy
- /pgp start
- /pgp sendpub
- /ox start
- /omemo start
- /omemo fingerprint
- /omemo trust
- /omemo untrust
- /win
- /invite send
- /status get
- /vcard get
- /vcard photo open
- /vcard photo save
@mdosch @weiss @sjaeckel
What are your opinions? Should we generally make roster_contact_autocomplete() autocomplete substrings? Or should we do it as proposed in this PR. That we have two functions, one for the exact prefix and the other for substring.
If we do the latter, do we want it for more functions than /msg?
If you have a lot of Arthurs the issue of having to tab a lot till you find the right Arthur can happen with any command, so I think we should allow the substring search everywhere. But for the ordering I'd like to rank hits starting with the search term higher.
E.g. if you have "Arthur Anchor", Arthur Boyle", "Arthur Clarke", "Arthur Dent" and "Clark Kent" /msg Clark<tab> should show "Clark Kent" first and then "Arthur Clarke".