浏览代码

NaturalSort: strings start with . treated differently

Poommetee Ketson 8 年之前
父节点
当前提交
ff03d846eb
共有 1 个文件被更改,包括 12 次插入0 次删除
  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)