fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit 496a7256dffd7be922a3deffb122751472e354bd
parent bf14373ba814938183799f6a0bf5e39e3047e192
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sat, 12 Jul 2014 15:22:44 -0700

Add some special cases

Diffstat:
Mmatch.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/match.c b/match.c @@ -1,4 +1,5 @@ #include <ctype.h> +#include <string.h> static int is_subset(const char *needle, const char *haystack){ while(*needle){ @@ -11,8 +12,13 @@ static int is_subset(const char *needle, const char *haystack){ } double match(const char *needle, const char *haystack){ - if(!is_subset(needle, haystack)){ + if(!*needle){ + return 1.0; + }else if(!is_subset(needle, haystack)){ return 0.0; + }else if(!strcasecmp(needle, haystack)){ + return 1.0; + }else{ + return 0.9; } - return 1.0; }