Explorar o código

Fixing project window search

Marko Pintera %!s(int64=10) %!d(string=hai) anos
pai
achega
a1eb70dd8b
Modificáronse 3 ficheiros con 3 adicións e 6 borrados
  1. 2 2
      BansheeEditor/Source/BsProjectLibrary.cpp
  2. 1 1
      MBansheeEditor/ProjectWindow.cs
  3. 0 3
      TODO.txt

+ 2 - 2
BansheeEditor/Source/BsProjectLibrary.cpp

@@ -461,7 +461,7 @@ namespace BansheeEngine
 		WString wildcardReplace(L".*");
 		WString wildcardReplace(L".*");
 		WString searchPattern = std::regex_replace(escapedPattern, wildcard, L".*");
 		WString searchPattern = std::regex_replace(escapedPattern, wildcard, L".*");
 
 
-		std::wregex searchRegex(searchPattern);
+		std::wregex searchRegex(searchPattern, std::regex_constants::ECMAScript | std::regex_constants::icase);
 
 
 		Stack<DirectoryEntry*> todo;
 		Stack<DirectoryEntry*> todo;
 		todo.push(mRootEntry);
 		todo.push(mRootEntry);
@@ -504,7 +504,7 @@ namespace BansheeEngine
 		std::sort(foundEntries.begin(), foundEntries.end(), 
 		std::sort(foundEntries.begin(), foundEntries.end(), 
 			[&](const LibraryEntry* a, const LibraryEntry* b) 
 			[&](const LibraryEntry* a, const LibraryEntry* b) 
 		{ 
 		{ 
-			return a->elementName.compare(b->elementName);
+			return a->elementName.compare(b->elementName) < 0;
 		});
 		});
 
 
 		return foundEntries;
 		return foundEntries;

+ 1 - 1
MBansheeEditor/ProjectWindow.cs

@@ -902,7 +902,7 @@ namespace BansheeEditor
             LibraryEntry[] entriesToDisplay = new LibraryEntry[0];
             LibraryEntry[] entriesToDisplay = new LibraryEntry[0];
             if (IsSearchActive)
             if (IsSearchActive)
             {
             {
-                entriesToDisplay = ProjectLibrary.Search(searchQuery);
+                entriesToDisplay = ProjectLibrary.Search("*" + searchQuery + "*");
             }
             }
             else
             else
             {
             {

+ 0 - 3
TODO.txt

@@ -29,9 +29,6 @@ TODO - Might need to handle overwritting better when importing/moving
 
 
 Simple tasks:
 Simple tasks:
  - Hook up scene view drag and drop instantiation
  - Hook up scene view drag and drop instantiation
- - Search should be case insensitive
- - Search breaks when I type in *
- - Search only works with exact matches but it should be more robust (append * to start/end automatically?)
 
 
 Test:
 Test:
  - See how are elements and search results ordered (should be by name)
  - See how are elements and search results ordered (should be by name)