Fix edge case where user could still enter tilde/space characters as first characters in console

This could be done by entering a character in the console (setting m_nInputTextLen > 0), then selecting and replacing valid 'first' character out for a tilde/space. This fixes the issue.
This commit is contained in:
Kawe Mazidjatari 2022-11-10 22:03:27 +01:00
parent 5dd5f2ad11
commit b81566604f

View File

@ -888,6 +888,14 @@ int CConsole::TextEditCallback(ImGuiInputTextCallbackData* iData)
}
case ImGuiInputTextFlags_CallbackEdit:
{
// If user selected all text in the input field and replaces it with
// a tilde or space character, it will be set as the first character
// in the input field as m_nInputTextLen is set before the actual edit.
while (iData->Buf[0] == '~' || iData->Buf[0] == ' ')
{
iData->DeleteChars(0, 1);
}
if (iData->BufTextLen) // Attempt to build a summary..
{
m_bCanAutoComplete = true;