toejough / pimento

simple CLI menu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use fuzzy matching instead of just search matching

toejough opened this issue · comments

Search matching

  • "a thing over there" is matched by "thing"
  • ... or "over"
  • ... but not "over thing" (wrong order)

Fuzzy matching

  • "a thing over there" is matched by "over thing" (both words are in the phrase)

Basically, make a more versatile matcher by matching options which contain all of the words or partials in the user input.

This must be implemented prior to implementing #27 if tab-completion. Tab-completion is being performed via readline. It's not possible (that I can see) to do tab-completion with readline on whole phrases if they aren't in the same place in the option:

  • "a thing over there"
  • "one thing over here"

They both share "thing over", but in different positions, so readline can't figure out how to complete it as a whole phrase.

It can, however, complete individual words, which makes fuzzy matching a more compatible option that search matching.

Also fuzzy matching is more versatile and doesn't require you to back-arrow to disambiguate if you were typing a word that only matches at the end of several options.