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
134
+
typedefint ImGuiTextFilterMode; // -> enum ImGuiTextFilterMode_ // Enum: To control how text filter handles multiple words
135
+
typedefint ImGuiTextFilterMatchResult; // -> enum ImGuiTextFilterMatchResult_ // Enum: A match identifier to better control applying a text filter over multiple fields
133
136
typedefint ImDrawCornerFlags; // -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect*() etc.
134
137
typedefint ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList
135
138
typedefint ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas
@@ -1585,6 +1588,12 @@ struct ImGuiOnceUponAFrame
1585
1588
#defineIMGUI_ONCE_UPON_A_FRAMEstatic ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf) // OBSOLETED in 1.51, will remove!
1586
1589
#endif
1587
1590
1591
+
enum ImGuiTextFilterMode_
1592
+
{
1593
+
ImGuiTextFilterMode_Or, // A single word match will pass the filter
1594
+
ImGuiTextFilterMode_And // All words must match to pass the filter
1595
+
};
1596
+
1588
1597
// 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
1626
+
char WordSplitter; // Character used to split user string, ',' by default
1627
+
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
1628
+
};
1629
+
1630
+
enum ImGuiTextFilterMatchResult_
1631
+
{
1632
+
ImGuiTextFilterMatchResultNone, // There have been no matches or failures
1633
+
ImGuiTextFilterMatchResultFail, // The match explicitly failed because of a subtractive clause or because no positive matches passed
1634
+
ImGuiTextFilterMatchResultPass, // The match explicitly passed because of positive match
1635
+
};
1636
+
1637
+
// Helper: Extend a single ImGuiTextFilter to multiple fields. It tracks explicit pass/failure conditions and will
1638
+
// stop processing text after an explicit failure.
0 commit comments