Use GetKeyIndex for Z, Y, C, V and X keys to make sure they go through ImGui's key map.
diff --git a/TextEditor.cpp b/TextEditor.cpp index 8721641..a25896c 100644 --- a/TextEditor.cpp +++ b/TextEditor.cpp
@@ -465,11 +465,11 @@ io.WantCaptureKeyboard = true; io.WantTextInput = true; - if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed('Z')) + if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z))) Undo(); else if (!IsReadOnly() && !ctrl && !shift && alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Backspace))) Undo(); - else if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed('Y')) + else if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Y))) Redo(); else if (!ctrl && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow))) MoveUp(1, shift); @@ -499,13 +499,13 @@ mOverwrite ^= true; else if (ctrl && !shift && !alt && ImGui::IsKeyPressed(45)) Copy(); - else if (ctrl && !shift && !alt && ImGui::IsKeyPressed('C')) + else if (ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C))) Copy(); else if (!IsReadOnly() && !ctrl && shift && !alt && ImGui::IsKeyPressed(45)) Paste(); - else if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed('V')) + else if (!IsReadOnly() && ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V))) Paste(); - else if (ctrl && !shift && !alt && ImGui::IsKeyPressed('X')) + else if (ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X))) Cut(); else if (!ctrl && shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) Cut();