Closed irfanderdiyok closed 10 months ago
Thanks, I'll look into this.
I'm having trouble reproducing this issue. Can you provide the following:
private static int Search(string needle, string haystack)
{
int[] T = Preprocess(needle);
int skip = 0;
while (haystack.Length - skip >= needle.Length)
{
if (Same(haystack.Substring(skip), needle, needle.Length))
return skip;
// skip = skip + T[haystack[skip + needle.Length]];
skip += 1;
}
return -1;
}
Hi Changed Search to this in QuickSearch.cs and this worked for me :)
Thank You @ILLNOISE143
Just committed a fix for this. My guess is that this issue was caused by non-ASCII search characters. I was trying to do something clever here and use a more efficient search algorithm, but it looks like it's too issue-prone to be worth it. I've just changed it to a String.IndexOf
instead.
unity 2021.3.21f1 editor
IndexOutOfRangeException: Index was outside the bounds of the array. QuickSearch.Search (System.String needle, System.String haystack) (at Assets/Schema/Editor/Window/QuickSearch.cs:342) QuickSearch.SearchThroughResults (System.Collections.Generic.IEnumerable:0)
UnityEditor.EditorWindow:EndWindows()
SchemaEditor.Internal.ComponentSystem.Components.WindowComponent:OnGUI() (at Assets/Schema/Editor/Canvas/Components/WindowComponent.cs:61)
SchemaEditor.Internal.ComponentCanvas:Draw() (at Assets/Schema/Editor/Canvas/ComponentCanvas.cs:265)
SchemaEditor.NodeEditor:OnGUI() (at Assets/Schema/Editor/Window/NodeEditorGUI.cs:45)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
1[T] types, System.String query) (at Assets/Schema/Editor/Window/QuickSearch.cs:322) QuickSearch.<CorrectSelection>b__31_0 () (at Assets/Schema/Editor/Window/QuickSearch.cs:298) Schema.Utilities.CacheDictionary
2[T1,T2].GetOrCreate (T1 key, System.Func`1[TResult] default) (at Assets/Schema/Utilities/CacheDictionary.cs:13) QuickSearch.CorrectSelection (System.Int32 selected) (at Assets/Schema/Editor/Window/QuickSearch.cs:298) QuickSearch.Focus () (at Assets/Schema/Editor/Window/QuickSearch.cs:286) QuickSearch.OnGUI (System.Int32 id) (at Assets/Schema/Editor/Window/QuickSearch.cs:65) UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at