Comments, minor tweaks to ImGuiTextFilter.

This commit is contained in:
ocornut 2024-07-29 22:34:34 +02:00
parent df38704926
commit c2a3d5e47b
2 changed files with 11 additions and 8 deletions

View File

@ -50,10 +50,11 @@ Breaking changes:
You should never need those functions! You can do everything in less a confusing manner by only
using GetCursorScreenPos() and GetContentRegionAvail(). Also always consider that if you are using
GetWindowPos() and GetCursorPos() you may also be making things unnecessarily complicated.
I repeat: You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!!
- GetWindowContentRegionMax().x - GetCursorPos().x --> GetContentRegionAvail().x
- GetWindowContentRegionMax().x + GetWindowPos().x --> GetCursorScreenPos().x + GetContentRegionAvail().x
- GetContentRegionMax() --> GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates
I repeat: You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!
- GetWindowContentRegionMax().x - GetCursorPos().x --> GetContentRegionAvail().x
- GetWindowContentRegionMax().x + GetWindowPos().x --> GetCursorScreenPos().x + GetContentRegionAvail().x // when called from left edge of window
- GetContentRegionMax() --> GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in local coordinates
- GetWindowContentRegionMax().x - GetWindowContentRegionMin().x --> GetContentRegionAvail() // when called from left edge of window
- Item flag changes:
- Obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag()/PopItemFlag()
with ImGuiItemFlags_ButtonRepeat. Kept inline redirecting functions (will obsolete).

View File

@ -435,9 +435,11 @@ CODE
- instead of: GetWindowContentRegionMax().x - GetCursorPos().x
- you can use: GetContentRegionAvail().x
- instead of: GetWindowContentRegionMax().x + GetWindowPos().x
- you can use: GetCursorScreenPos().x + GetContentRegionAvail().x (from left edge of window)
- you can use: GetCursorScreenPos().x + GetContentRegionAvail().x // when called from left edge of window
- instead of: GetContentRegionMax()
- you cna use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates
- you can use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in local coordinates
- instead of: GetWindowContentRegionMax().x - GetWindowContentRegionMin().x
- you can use: GetContentRegionAvail() // when called from left edge of window
- 2024/07/15 (1.91.0) - renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573)
(internals: also renamed ImGuiItemFlags_SelectableDontClosePopup into ImGuiItemFlags_AutoClosePopups with inverted behaviors)
- 2024/07/15 (1.91.0) - obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag(ImGuiItemFlags_ButtonRepeat, ...)/PopItemFlag().
@ -2753,11 +2755,11 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
return true;
if (text == NULL)
text = "";
text = text_end = "";
for (const ImGuiTextRange& f : Filters)
{
if (f.empty())
if (f.b == f.e)
continue;
if (f.b[0] == '-')
{