1
0
Fork 0

Merge pull request #78321 from ajreckof/fix-wrong-alphabetical-order-in-autocompletion-sorting

Fix wrong order in autocompletion sorting with empty string to complete.
This commit is contained in:
Rémi Verschelde 2023-06-16 16:52:27 +02:00
commit c65aba7aff
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 2 additions and 4 deletions

View File

@ -338,7 +338,7 @@ public:
Ref<Resource> icon;
Variant default_value;
Vector<Pair<int, int>> matches;
Vector<Pair<int, int>> last_matches;
Vector<Pair<int, int>> last_matches = { { -1, -1 } }; // This value correspond to an impossible match
int location = LOCATION_OTHER;
CodeCompletionOption() {}

View File

@ -3326,8 +3326,6 @@ CodeEdit::~CodeEdit() {
// Return true if l should come before r
bool CodeCompletionOptionCompare::operator()(const ScriptLanguage::CodeCompletionOption &l, const ScriptLanguage::CodeCompletionOption &r) const {
// Check if we are not completing an empty string in this case there is no reason to get matches characteristics.
TypedArray<int> lcharac = l.get_option_cached_characteristics();
TypedArray<int> rcharac = r.get_option_cached_characteristics();
@ -3344,5 +3342,5 @@ bool CodeCompletionOptionCompare::operator()(const ScriptLanguage::CodeCompletio
return l.matches[i].second > r.matches[i].second;
}
}
return l.display < r.display;
return l.display.naturalnocasecmp_to(r.display) < 0;
}