Browse code

Break match ties by length of result

John Hawthorn authored on 13/07/2014 04:59:22
Showing 1 changed files

  • fzy.c index 237337f..ae20402 100644
... ...
@@ -64,7 +64,8 @@ static int cmpchoice(const void *p1, const void *p2) {
64 64
 	double score2 = choices_score[idx2];
65 65
 
66 66
 	if(score1 == score2)
67
-		return 0;
67
+		/* break ties by length of result */
68
+		return strlen(choices[idx1]) - strlen(choices[idx2]);
68 69
 	else if(score1 < score2)
69 70
 		return 1;
70 71
 	else