瀏覽代碼

fix sorting

Laserlicht 3 月之前
父節點
當前提交
2751ada585
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      client/windows/GUIClasses.cpp

+ 3 - 1
client/windows/GUIClasses.cpp

@@ -1653,8 +1653,10 @@ void CObjectListWindow::itemsSearchCallback(const std::string & text)
 	}
 	}
 
 
 	// Sort: Lower score is better match
 	// Sort: Lower score is better match
-	std::sort(rankedItems.begin(), rankedItems.end(), [](const auto & a, const auto & b)
+	std::sort(rankedItems.begin(), rankedItems.end(), [text](const auto & a, const auto & b)
 	{
 	{
+		if(a.first == b.first || text.empty())
+			return a.second < b.second;
 		return a.first < b.first;
 		return a.first < b.first;
 	});
 	});