Procházet zdrojové kódy

Merge pull request #8978 from noshyaar/pr-sort

NaturalSort: strings start with . treated differently
Rémi Verschelde před 8 roky
rodič
revize
b3c6d9914a
1 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. 12 0
      core/ustring.cpp

+ 12 - 0
core/ustring.cpp

@@ -489,6 +489,18 @@ signed char String::naturalnocasecmp_to(const String &p_str) const {
 	const CharType *that_str = p_str.c_str();
 
 	if (this_str && that_str) {
+
+		while (*this_str == '.' || *that_str == '.') {
+			if (*this_str++ != '.')
+				return 1;
+			if (*that_str++ != '.')
+				return -1;
+			if (!*that_str)
+				return 1;
+			if (!*this_str)
+				return -1;
+		}
+
 		while (*this_str) {
 
 			if (!*that_str)