summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-14 09:37:15 +0200
committerGitHub <noreply@github.com>2018-08-14 09:37:15 +0200
commitac2add26a1da33e3445b89629657f087c554247a (patch)
treecdb7db7268e4ea0de168fd602ec421746a2c1258
parent3ebbd0976597a8222aa4883b0a48415202fc1dfd (diff)
parent109028f52b34563f56f59c96097cebc4ae5b3f74 (diff)
Merge pull request #20981 from gotnospirit/case_aware_autocomplete
Case-aware autocomplete: prefer same case candidates
-rw-r--r--scene/gui/text_edit.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index c702bc70d0..949b6e6098 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -5770,8 +5770,11 @@ void TextEdit::_update_completion_candidates() {
}
// Calculate the similarity to keep completions in good order
float similarity;
- if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
- // Substrings are the best candidates
+ if (completion_strings[i].begins_with(s)) {
+ // Substrings (same case) are the best candidates
+ similarity = 1.2;
+ } else if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
+ // then any substrings
similarity = 1.1;
} else {
// Otherwise compute the similarity