fzy

terminal fuzzy finder picker

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

commit 3f32169f0929ec8945e2e59f8e2ec3a20273dc2c
parent 0c1c6b65e3aaaf1ad458cf3fc9ad422ade967458
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sat,  6 Sep 2014 18:33:55 -0700

Adjust and reformat match inner loop

Diffstat:
Mmatch.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/match.c b/match.c @@ -118,16 +118,16 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio if(!i){ score = (j * SCORE_GAP_LEADING) + match_bonus[j]; }else if(j){ - score = max(score, M[i-1][j-1] + match_bonus[j]); + score = max( + M[i-1][j-1] + match_bonus[j], - /* consecutive match, doesn't stack with match_bonus */ - score = max(score, D[i-1][j-1] + SCORE_MATCH_CONSECUTIVE); + /* consecutive match, doesn't stack with match_bonus */ + D[i-1][j-1] + SCORE_MATCH_CONSECUTIVE + ); } } D[i][j] = score; - score = max(score, prev_score + gap_score); - M[i][j] = score; - prev_score = score; + M[i][j] = prev_score = max(score, prev_score + gap_score); } }