소스 검색

Editor autocomplete: prefer same case candidates

James 7 년 전
부모
커밋
109028f52b
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      scene/gui/text_edit.cpp

+ 5 - 2
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