imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Fix a bug in ImGuiTextFilter and extend it to be more customizable

Open kudaba opened this issue 6 years ago • 3 comments

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)
{
	...
}

kudaba avatar Mar 20 '19 02:03 kudaba

Why closing and deleting this?

ocornut avatar May 09 '20 07:05 ocornut

I was updating/cleaning up old prs, must have mis-clicked on this one, it's still alive and well.

kudaba avatar May 09 '20 22:05 kudaba

Created https://github.com/kudaba/imgui/pull/1 to extend this by exposing the new customization options to users

phisko avatar Sep 29 '22 14:09 phisko