ajitid / fzf-for-js

Do fuzzy matching using FZF algorithm in JavaScript
https://fzf.netlify.app
BSD 3-Clause "New" or "Revised" License
887 stars 21 forks source link

Make an exact-match that is case-sensitive #111

Open simonduchen opened 1 year ago

simonduchen commented 1 year ago

When searching for an exact match using single-quote before the search string, with extended search mode enabled: I would expect the result to be exact as, non-fuzzy and case-sensitive. But the matches are only non-fuzzy. For example: const fzf = new Fzf(['Hello', 'hello', 'HeLLo'], {match: extendedMatch}); const result = fzf.find("'hello").map(({item}) => item); // result: ['Hello', 'hello', 'heLLo']

But I would expect: const result = fzf.find("'hello").map(({item}) => item); // result: ['hello']

There is a similar request for the fzf-cli: https://github.com/junegunn/fzf/issues/2613

My proposal is the same as in the ticket mentioned above, either make a another function for a true exact-match and rename the current one to non-fuzzy match, or make the current exact-match case-sensitive.

ajitid commented 1 year ago

Heya, I agree that we have a use-case here.

This library closely follows the core logic of fzf-cli. And to avoid the risk of breaking backwards compatibility, I'll wait for fzf-cli to get an implementation first. I have subscribed to the ticket you mentioned, and rest assured, this library would get an update as well.