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

ImGuiInputTextCallback: NULL buffer when ReadOnly #4762

Closed
actondev opened this issue Nov 24, 2021 · 1 comment
Closed

ImGuiInputTextCallback: NULL buffer when ReadOnly #4762

actondev opened this issue Nov 24, 2021 · 1 comment

Comments

@actondev
Copy link

Version: v1.85
Branch: master

When passing the ImGuiInputTextFlags_ReadOnly to InputText, the callback_data.Buf is null. Meanwhile, BufTextLen is (correctly) the text length.

Something like

                     callback_data.EventKey = event_key;
-                    callback_data.Buf = state->TextA.Data;
+                    callback_data.Buf = state->TextAIsValid ? state->TextA.Data : state->InitialTextA.Data;
                     callback_data.BufTextLen = state->CurLenA;

seems to be semantically correct, but then

IM_ASSERT(callback_data.Buf == state->TextA.Data);

will fail

@ocornut
Copy link
Owner

ocornut commented Nov 25, 2021

Thank you! Pushed a fix 5ac25e7

@ocornut ocornut closed this as completed Nov 25, 2021
actondev pushed a commit to actondev/imgui that referenced this issue Nov 26, 2021
ocornut added a commit that referenced this issue Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants