You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extend ImGuiTextFilter to be customizable and usable for 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.
typedefint ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
133
+
typedefint ImGuiTextFilterMode; // -> enum ImGuiTextFilterMode_ // Enum: To control how text filter handles multiple words
134
+
typedefint ImGuiTextFilterMatchResult; // -> enum ImGuiTextFilterMatchResult_ // Enum: A match identifier to better control applying a text filter over multiple fields
132
135
typedefint ImDrawCornerFlags; // -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect*() etc.
133
136
typedefint ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList
134
137
typedefint ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas
@@ -1572,6 +1575,12 @@ struct ImGuiOnceUponAFrame
1572
1575
#defineIMGUI_ONCE_UPON_A_FRAMEstatic ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf) // OBSOLETED in 1.51, will remove!
1573
1576
#endif
1574
1577
1578
+
enum ImGuiTextFilterMode_
1579
+
{
1580
+
ImGuiTextFilterMode_Or, // A single word match will pass the filter
1581
+
ImGuiTextFilterMode_And // All words must match to pass the filter
1582
+
};
1583
+
1575
1584
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
ImGuiTextFilterMode MatchMode; // if true then all words must match, otherwise any matching word will be a pass
1613
+
char WordSplitter; // Character used to split user string, ',' by default
1614
+
char MinWordSize; // Minimum number of characters before a word is used for matching, can help improve UX by avoiding mass matching against 1 or 2 characters
1615
+
};
1616
+
1617
+
enum ImGuiTextFilterMatchResult_
1618
+
{
1619
+
ImGuiTextFilterMatchResultNone, // There have been no matches or failures
1620
+
ImGuiTextFilterMatchResultFail, // The match explicitly failed because of a subtractive clause or because no positive matches passed
1621
+
ImGuiTextFilterMatchResultPass, // The match explicitly passed because of positive match
1622
+
};
1623
+
1624
+
// Helper: Extend a single ImGuiTextFilter to multiple fields. It tracks explicit pass/failure conditions and will
1625
+
// stop processing text after an explicit failure.
0 commit comments