mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-06 06:25:54 +01:00
InputText: fixed ImGuiInputTextCallbackData::InsertChars() mistakenly over growing internal buffer. (#9603, #7925)
Note that the 32-256 ranges may seem misleading because ImVector<> handle its growth policy but it is also the size we request to underlying user impl hence the clamps.
This commit is contained in:
parent
a13badd73e
commit
1023d3ddaa
@ -4471,7 +4471,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons
|
|||||||
if (new_text_len + BufTextLen + 1 > obj->TextA.Size && is_resizable && !is_readonly)
|
if (new_text_len + BufTextLen + 1 > obj->TextA.Size && is_resizable && !is_readonly)
|
||||||
{
|
{
|
||||||
IM_ASSERT(Buf == obj->TextA.Data);
|
IM_ASSERT(Buf == obj->TextA.Data);
|
||||||
int new_buf_size = BufTextLen + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1;
|
int new_buf_size = BufTextLen + ImClamp(new_text_len, 32, ImMax(256, new_text_len)) + 1;
|
||||||
obj->TextA.resize(new_buf_size + 1);
|
obj->TextA.resize(new_buf_size + 1);
|
||||||
obj->TextSrc = obj->TextA.Data;
|
obj->TextSrc = obj->TextA.Data;
|
||||||
Buf = obj->TextA.Data;
|
Buf = obj->TextA.Data;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user