diff options
author | James <gotnospirit@gmail.com> | 2018-08-13 20:45:33 +0200 |
---|---|---|
committer | James <gotnospirit@gmail.com> | 2018-08-13 20:45:33 +0200 |
commit | 109028f52b34563f56f59c96097cebc4ae5b3f74 (patch) | |
tree | b5d17cd4ef77a6bd2a46b71e5d026e435b6bfac1 /scene | |
parent | b6b722d5c1cb71ed6370a0673c52684e1d7ce724 (diff) |
Editor autocomplete: prefer same case candidates
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 7 |
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 |