InputText: Clarified comments around ImGuiInputTextFlags_CallbackResize and other callbacks. (#2006, #1443, #1008)

This commit is contained in:
omar
2018-10-12 10:14:03 +02:00
parent ed4dcd9072
commit 74c0309126
2 changed files with 16 additions and 12 deletions

View File

@ -22,6 +22,7 @@ static int InputTextCallback(ImGuiInputTextCallbackData* data)
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
{
// Resize string callback
// If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
std::string* str = user_data->Str;
IM_ASSERT(data->Buf == str->c_str());
str->resize(data->BufTextLen);