Fix bug in resource manager tab. Add missing FullContext push.

This commit is contained in:
Ottermandias 2026-01-10 21:30:13 +01:00
parent aa4ceae52f
commit caf896e5e9
3 changed files with 22 additions and 13 deletions

2
Luna

@ -1 +1 @@
Subproject commit 59967db0b6fba6e85d04d91e91ed07a35cb42d69 Subproject commit a602d059783e244017200c04d97603f37ca2166a

View file

@ -265,9 +265,10 @@ public sealed class ModFilter(ModManager modManager, ActiveCollections collectio
{ {
if (token.Type switch if (token.Type switch
{ {
ModFilterTokenType.Name => folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Name => !folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
ModFilterTokenType.Default => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Default => !folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => true, ModFilterTokenType.FullContext => !folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => true,
}) })
return false; return false;
} }
@ -276,9 +277,10 @@ public sealed class ModFilter(ModManager modManager, ActiveCollections collectio
{ {
if (token.Type switch if (token.Type switch
{ {
ModFilterTokenType.Name => folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Name => folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
ModFilterTokenType.Default => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Default => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => false, ModFilterTokenType.FullContext => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => false,
}) })
return false; return false;
} }
@ -287,9 +289,10 @@ public sealed class ModFilter(ModManager modManager, ActiveCollections collectio
{ {
if (token.Type switch if (token.Type switch
{ {
ModFilterTokenType.Name => folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Name => folder.Name.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
ModFilterTokenType.Default => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase), ModFilterTokenType.Default => folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => false, ModFilterTokenType.FullContext => !folder.FullPath.Contains(token.Needle, StringComparison.OrdinalIgnoreCase),
_ => false,
}) })
return true; return true;
} }

View file

@ -20,13 +20,19 @@ public sealed class ResourceTab(Configuration config, ResourceManagerService res
public bool IsVisible public bool IsVisible
=> config.DebugMode; => config.DebugMode;
public readonly TextFilter Filter = new(); public readonly ResourceFilter Filter = new();
public sealed class ResourceFilter : Utf8FilterBase<ResourceHandle>
{
protected override ReadOnlySpan<byte> ToFilterString(in ResourceHandle item, int globalIndex)
=> item.FileName.AsSpan();
}
/// <summary> Draw a tab to iterate over the main resource maps and see what resources are currently loaded. </summary> /// <summary> Draw a tab to iterate over the main resource maps and see what resources are currently loaded. </summary>
public unsafe void DrawContent() public unsafe void DrawContent()
{ {
// Filter for resources containing the input string. // Filter for resources containing the input string.
Filter.DrawFilter("##ResourceFilter"u8, Im.ContentRegion.Available); Filter.DrawFilter("Filter..."u8, Im.ContentRegion.Available);
using var child = Im.Child.Begin("##ResourceManagerTab"u8, Im.ContentRegion.Available); using var child = Im.Child.Begin("##ResourceManagerTab"u8, Im.ContentRegion.Available);
if (!child) if (!child)
return; return;
@ -75,7 +81,7 @@ public sealed class ResourceTab(Configuration config, ResourceManagerService res
resourceManager.IterateResourceMap(map, (hash, r) => resourceManager.IterateResourceMap(map, (hash, r) =>
{ {
// Filter unwanted names. // Filter unwanted names.
if (Filter.Text.Length > 0 && Filter.WouldBeVisible(r->FileName.ToString(), -1)) if (!Filter.WouldBeVisible(in *r, -1))
return; return;
Im.Table.DrawColumn($"0x{hash:X8}"); Im.Table.DrawColumn($"0x{hash:X8}");