This reverts commit e77435e4c26cc5d2c879452d9310890763df0b96.
| ... | ... |
@@ -63,7 +63,13 @@ static int cmpchoice(const void *p1, const void *p2) {
|
| 63 | 63 |
double score1 = choices_score[idx1]; |
| 64 | 64 |
double score2 = choices_score[idx2]; |
| 65 | 65 |
|
| 66 |
- return score1 - score2; |
|
| 66 |
+ if(score1 == score2) |
|
| 67 |
+ /* break ties by length of result */ |
|
| 68 |
+ return strlen(choices[idx1]) - strlen(choices[idx2]); |
|
| 69 |
+ else if(score1 < score2) |
|
| 70 |
+ return 1; |
|
| 71 |
+ else |
|
| 72 |
+ return -1; |
|
| 67 | 73 |
} |
| 68 | 74 |
|
| 69 | 75 |
void run_search(char *needle){
|