Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kudaba
Copy link
Contributor

@kudaba kudaba commented Mar 20, 2019

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

… multiple fields. Preserved current behavior and performance.

* 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.
@ocornut
Copy link
Owner

ocornut commented May 9, 2020

Why closing and deleting this?

@kudaba
Copy link
Contributor Author

kudaba commented May 9, 2020

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

@phisko
Copy link

phisko commented Sep 29, 2022

Created kudaba#1 to extend this by exposing the new customization options to users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants