mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-27 02:55:44 +08:00
InputText: fix for InsertChars() to work on read-only buffer. (#8714, #8689, #8242)
build / Windows (push) Has been cancelled
build / Linux (push) Has been cancelled
build / MacOS (push) Has been cancelled
build / iOS (push) Has been cancelled
build / Emscripten (push) Has been cancelled
build / Android (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
build / Windows (push) Has been cancelled
build / Linux (push) Has been cancelled
build / MacOS (push) Has been cancelled
build / iOS (push) Has been cancelled
build / Emscripten (push) Has been cancelled
build / Android (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
Ill defined feature but memory editor use InsertChars etc on a read-only buffer. `if (init_state)` block of InputTextEx() intentionally does not resize TextA, as unneeded. Amendb2c73596aeAmende900571
This commit is contained in:
+1
-1
@@ -4289,7 +4289,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons
|
|||||||
// Grow internal buffer if needed
|
// Grow internal buffer if needed
|
||||||
const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
|
const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
|
||||||
const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)ImStrlen(new_text);
|
const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)ImStrlen(new_text);
|
||||||
if (new_text_len + BufTextLen + 1 > obj->TextA.Size)
|
if (new_text_len + BufTextLen + 1 > obj->TextA.Size && (Flags & ImGuiInputTextFlags_ReadOnly) == 0)
|
||||||
{
|
{
|
||||||
if (!is_resizable)
|
if (!is_resizable)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user