1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Demo: fix casing swap demo inserting garbage characters when typing lowercase letters (#6482)

This commit is contained in:
Christian Fillion 2023-06-01 04:17:32 -04:00 committed by GitHub
parent 5319d1cffa
commit f1777f9517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1393,8 +1393,8 @@ static void ShowDemoWindowWidgets()
// Modify character input by altering 'data->Eventchar' (ImGuiInputTextFlags_CallbackCharFilter callback)
static int FilterCasingSwap(ImGuiInputTextCallbackData* data)
{
if (data->EventChar >= 'a' && data->EventChar <= 'z') { data->EventChar = data->EventChar - 'A' - 'a'; } // Lowercase becomes uppercase
else if (data->EventChar >= 'A' && data->EventChar <= 'Z') { data->EventChar = data->EventChar + 'a' - 'A'; } // Uppercase becomes lowercase
if (data->EventChar >= 'a' && data->EventChar <= 'z') { data->EventChar -= 'a' - 'A'; } // Lowercase becomes uppercase
else if (data->EventChar >= 'A' && data->EventChar <= 'Z') { data->EventChar += 'a' - 'A'; } // Uppercase becomes lowercase
return 0;
}