imgui
imgui copied to clipboard
Fix a bug in ImGuiTextFilter and extend it to be more customizable
Context: Depending on the context I like to use different filtering modes. This lets me tweak the behavior without having to completely write a whole new system each time.
I made sure to preserve the current behavior and performance.
Changes:
- Fixed negative matches not working when located after a positive matches. Optimized by keeping all negative matches at the front of the filter list.
- Add the following customization options:
- Custom split character, default is still ','
- Minimum word match length can be used to keep the search more stable for the first couple characters of input
- Match mode can be switch from Or (any pass causes a success) to And (all positive filters must match).
- Add a utility to allow applying a single filter to multiple fields.
Multi field filter usage:
ImGuiTextFilterMatch match(myFilter);
match.PassFilter(item.Name);
match.PassFilter(item.Error.ToString());
match.PassFilter(item.Message);
if (match)
{
...
}
Why closing and deleting this?
I was updating/cleaning up old prs, must have mis-clicked on this one, it's still alive and well.
Created https://github.com/kudaba/imgui/pull/1 to extend this by exposing the new customization options to users