fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit c61dc914984e85d4506b8e28b15accef7f6cda20 parent ab4b83c438a22c2309179e1602bfed3ad14dbd2e Author: John Hawthorn <john.hawthorn@gmail.com> Date: Sun, 3 Aug 2014 19:17:32 -0700 Use SCORE_MATCH_SLASH for first character Diffstat:
| M | fzytest.c | | | 3 | +++ |
| M | match.c | | | 2 | +- |
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fzytest.c b/fzytest.c @@ -44,6 +44,9 @@ int test_scoring(){ /* Prefer shorter matches */ assert(match("test", "tests") > match("test", "testing")); + /* Scores first letter highly */ + assert(match("test", "testing") > match("test", "/testing")); + /* Prefer shorter matches */ assert(match("abc", " a b c ") > match("abc", " a b c ")); assert(match("abc", " a b c ") > match("abc", " a b c ")); diff --git a/match.c b/match.c @@ -81,7 +81,7 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio score_t score = 0; if(isalnum(ch)){ - if(last_ch == '/'){ + if(!last_ch || last_ch == '/'){ score = SCORE_MATCH_SLASH; }else if(last_ch == '-' || last_ch == '_' ||