mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
vim-patch:9.1.0093: Still a qsort() comparison function that returns result of subtraction
Problem: Still a qsort() comparison function fuzzy_match_item_compare()
that returns result of subtraction (after 9.1.0089).
Solution: Use an explicit comparison instead of subtraction.
(zeertzjq)
closes: vim/vim#14004
77078276bf
This commit is contained in:
@@ -3197,7 +3197,11 @@ static int fuzzy_match_item_compare(const void *const s1, const void *const s2)
|
|||||||
const int idx1 = ((const fuzzyItem_T *)s1)->idx;
|
const int idx1 = ((const fuzzyItem_T *)s1)->idx;
|
||||||
const int idx2 = ((const fuzzyItem_T *)s2)->idx;
|
const int idx2 = ((const fuzzyItem_T *)s2)->idx;
|
||||||
|
|
||||||
return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1;
|
if (v1 == v2) {
|
||||||
|
return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1;
|
||||||
|
} else {
|
||||||
|
return v1 > v2 ? -1 : 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fuzzy search the string "str" in a list of "items" and return the matching
|
/// Fuzzy search the string "str" in a list of "items" and return the matching
|
||||||
|
Reference in New Issue
Block a user