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
My Issue/Question:
Calling InsertChars() in a callback results in an assertion thrown.
// - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.
callback_data.Buf = callback_buf;
// Call user codecallback(&callback_data);
// Read back what user may have modifiedIM_ASSERT(callback_data.Buf == callback_buf); // Invalid to modify those fields
How is this supposed to work?
If it's valid to use InsertChars to modify text in a callback, and InsertChars sets Buf, then why is it invalid for Buf to be set in the callback?
Standalone, minimal, complete and verifiable example:
This example might not show up in the Console demo, because as I understand, Buf is only resized when inputs are typed, so to set the contents to something you've previously entered isn't going to resize.
The text was updated successfully, but these errors were encountered:
Seems like a regression added last week by 5ac25e7, and afaik the code you quoted is not from 1.85 but from a more recent version. Can you confirm? I'll push a fix for current version.
Seems like a regression added last week by 5ac25e7, and afaik the code you quoted is not from 1.85 but from a more recent version. Can you confirm? I'll push a fix for current version.
Yeah, my mistake, I forgot I switched when I moved to the docking branch. Thanks for the fix!
Version/Branch of Dear ImGui:
Version: 1.85
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp + imgui_stdlib.h
My Issue/Question:
Calling
InsertChars()
in a callback results in an assertion thrown.// - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.
How is this supposed to work?
If it's valid to use
InsertChars
to modify text in a callback, andInsertChars
setsBuf
, then why is it invalid forBuf
to be set in the callback?Standalone, minimal, complete and verifiable example:
This example might not show up in the Console demo, because as I understand,
Buf
is only resized when inputs are typed, so to set the contents to something you've previously entered isn't going to resize.The text was updated successfully, but these errors were encountered: