profanity icon indicating copy to clipboard operation
profanity copied to clipboard

Implement substring autocompletion for /msg

Open jubalh opened this issue 1 year ago • 2 comments

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 will be faster.

Fix https://github.com/profanity-im/profanity/issues/1984

jubalh avatar Jun 20 '24 14:06 jubalh

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?

jubalh avatar Jun 24 '24 08:06 jubalh

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".

mdosch avatar Jun 26 '24 17:06 mdosch