Skip to content
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

Reactivated decimal point replacement for InputScalar, SliderScalar and DragScalar #7389

Conversation

GamingMinds-DanielC
Copy link
Contributor

As requested in #6719, here is a PR that reintroduces decimal point replacement (added in a1a7a1b, lost in 4a24264) without adding any other filtering. The fix is quite simple, but did require an additional internal flag.

@ocornut
Copy link
Owner

ocornut commented Mar 11, 2024

I think I'm fine with it. Bits 21 to 25 are also unused and anything private we have some extra freedom to move it elsewhere if needed. Thanks!
But I'm now confused why this section of the "widgets_inputtext_filters" test didn't trigger:
https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_suite/imgui_tests_widgets_inputtext.cpp#L976

#if IMGUI_VERSION_NUM >= 18983
        ctx->ItemClick("decimal");
        ctx->KeyCharsReplaceEnter(".,.,");
        IM_CHECK_STR_EQ(vars.Decimal.c_str(), "....");
#endif

Will try to investigate later when I have time.

@GamingMinds-DanielC
Copy link
Contributor Author

But I'm now confused why this section of the "widgets_inputtext_filters" test didn't trigger:

That test is on an input with the necessary filter flags given, so the replacements were not deactivated in this test and it wasn't broken as a result. SliderScalar and DragScalar didn't forward any filter flags to the temporary input anymore, that's why they were missing the replacement as well. This test doesn't cover those cases.

ocornut pushed a commit that referenced this pull request Apr 3, 2024
@ocornut
Copy link
Owner

ocornut commented Apr 3, 2024

This is merged, thank you. I have renamed the internal flag to ImGuiInputTextFlags_LocalizeDecimalPoint as it seemed a bit clearer what the intent was.

@ocornut ocornut closed this Apr 3, 2024
ocornut added a commit that referenced this pull request Aug 22, 2024
@ocornut
Copy link
Owner

ocornut commented Aug 22, 2024

FYI in today's change the storage of io.PlatformLocaleDecimalPoint has moved:
GetIO().PlatformLocaleDecimalPoint --> GetPlatformIO().Platform_LocaleDecimalPoint

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

Successfully merging this pull request may close these issues.

2 participants