fzy

terminal fuzzy finder picker

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

commit 37eb13008374419a190f7fd812be27f37d697bd9
parent a396682ffb0868b2e1096f98d23cbdcab5e815d2
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Thu, 18 Sep 2014 17:28:21 -0700

Move scoring constants into config.h

Diffstat:
Mconfig.h | 9+++++++++
Mmatch.c | 11++---------
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/config.h b/config.h @@ -1 +1,10 @@ #define TTY_COLOR_HIGHLIGHT TTY_COLOR_YELLOW + +#define SCORE_GAP_LEADING -0.005 +#define SCORE_GAP_TRAILING -0.005 +#define SCORE_GAP_INNER -0.01 +#define SCORE_MATCH_CONSECUTIVE 1.0 +#define SCORE_MATCH_SLASH 0.9 +#define SCORE_MATCH_WORD 0.8 +#define SCORE_MATCH_CAPITAL 0.7 +#define SCORE_MATCH_DOT 0.6 diff --git a/match.c b/match.c @@ -7,6 +7,8 @@ #include "match.h" +#include "config.h" + int has_match(const char *needle, const char *haystack){ while(*needle){ char nch = tolower(*needle++); @@ -75,15 +77,6 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio * M[][] Stores the best possible score at this position. */ -#define SCORE_GAP_LEADING -0.005 -#define SCORE_GAP_TRAILING -0.005 -#define SCORE_GAP_INNER -0.01 -#define SCORE_MATCH_CONSECUTIVE 1.0 -#define SCORE_MATCH_SLASH 0.9 -#define SCORE_MATCH_WORD 0.8 -#define SCORE_MATCH_CAPITAL 0.7 -#define SCORE_MATCH_DOT 0.6 - /* Which positions are beginning of words */ char last_ch = '\0'; for(int i = 0; i < m; i++){