fzy

terminal fuzzy finder picker

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

commit 1c048ebae35f579959a95457090a2c957f4a3f58
parent ca3e4f0a67ba7c14e697ead14b722d7d8b75cb52
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sun, 26 Jun 2016 23:10:25 -0700

Don't consider numbers word separators

This made sense on paper when deciding what was a "word". However in
reality this is rarely an indication of a separate word. I've found that
this caused hexadecimal or base64 strings to be favoured in matches.

Diffstat:
MALGORITHM.md | 2+-
Msrc/match.c | 3+--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/ALGORITHM.md b/ALGORITHM.md @@ -69,7 +69,7 @@ is able to score based on the optimal match. * Matches (positive score) * consecutive * following a slash - * following a space, underscore, dash, or number (the start of a word) + * following a space, underscore, or dash (the start of a word) * capital letter (the start of a CamelCase word) * following a dot (often a file extension) diff --git a/src/match.c b/src/match.c @@ -66,8 +66,7 @@ static void precompute_bonus(const char *haystack, score_t *match_bonus) { if (isalnum(ch)) { if (!last_ch || last_ch == '/') { score = SCORE_MATCH_SLASH; - } else if (last_ch == '-' || last_ch == '_' || last_ch == ' ' || - (last_ch >= '0' && last_ch <= '9')) { + } else if (last_ch == '-' || last_ch == '_' || last_ch == ' ') { score = SCORE_MATCH_WORD; } else if (last_ch >= 'a' && last_ch <= 'z' && ch >= 'A' && ch <= 'Z') { /* CamelCase */