mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-18 20:11:15 -03:00
Bravely remove string_fuzzy_match_t::compare
This is used to decide which fuzzy match is better, however it is used only in wildcard expansion and not in actual completion ranking or anywhere else where it could matter. Try removing the compare() call and implementation. What compare() did specially was compare distances, e.g. it ranks lib as better than libexec when expanding /u/l/b. But the tests did not exercise this so it's hard to know if it's working. In preparation for a refactoring, remove it.
This commit is contained in:
@@ -202,25 +202,6 @@ string_fuzzy_match_t string_fuzzy_match_string(const wcstring &string,
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline int compare_ints(T a, T b) {
|
||||
if (a < b) return -1;
|
||||
if (a == b) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// Compare types; if the types match, compare distances.
|
||||
int string_fuzzy_match_t::compare(const string_fuzzy_match_t &rhs) const {
|
||||
if (this->type != rhs.type) {
|
||||
return compare_ints(this->type, rhs.type);
|
||||
} else if (this->match_distance_first != rhs.match_distance_first) {
|
||||
return compare_ints(this->match_distance_first, rhs.match_distance_first);
|
||||
} else if (this->match_distance_second != rhs.match_distance_second) {
|
||||
return compare_ints(this->match_distance_second, rhs.match_distance_second);
|
||||
}
|
||||
return 0; // equal
|
||||
}
|
||||
|
||||
template <bool Fuzzy, typename T>
|
||||
size_t ifind_impl(const T &haystack, const T &needle) {
|
||||
using char_t = typename T::value_type;
|
||||
|
||||
Reference in New Issue
Block a user