Untested WIP (1844)
diff --git a/imgui.cpp b/imgui.cpp
index 63629f8..05cff78 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -7650,6 +7650,7 @@
"GamepadLStickLeft", "GamepadLStickRight", "GamepadLStickUp", "GamepadLStickDown",
"GamepadRStickLeft", "GamepadRStickRight", "GamepadRStickUp", "GamepadRStickDown",
"MouseLeft", "MouseRight", "MouseMiddle", "MouseX1", "MouseX2", "MouseWheelX", "MouseWheelY",
+ "Copy", "Cut", "Paste", "Undo", "Redo", "SelectAll",
"ModCtrl", "ModShift", "ModAlt", "ModSuper", // ReservedForModXXX are showing the ModXXX names.
};
IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames));
diff --git a/imgui.h b/imgui.h
index 8d8fdc5..56d44f4 100644
--- a/imgui.h
+++ b/imgui.h
@@ -1431,6 +1431,14 @@
ImGuiKey_GamepadRStickUp, // [Analog]
ImGuiKey_GamepadRStickDown, // [Analog]
+ // High-level/virtual keys (for e.g. web apps events)
+ ImGuiKey_Copy,
+ ImGuiKey_Cut,
+ ImGuiKey_Paste,
+ ImGuiKey_Undo,
+ ImGuiKey_Redo,
+ ImGuiKey_SelectAll,
+
// Aliases: Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls)
// - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API.
ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY,
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 5cbd39d..33c5189 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -4289,12 +4289,12 @@
// Using Shortcut() with ImGuiInputFlags_RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use CTRL+A and CTRL+B: formet would be handled by InputText)
// Otherwise we could simply assume that we own the keys as we are active.
const ImGuiInputFlags f_repeat = ImGuiInputFlags_Repeat;
- const bool is_cut = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_X, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, id, f_repeat)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
- const bool is_copy = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_C, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, id)) && !is_password && (!is_multiline || state->HasSelection());
- const bool is_paste = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_V, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, id, f_repeat)) && !is_readonly;
- const bool is_undo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Z, id, f_repeat)) && !is_readonly && is_undoable;
- const bool is_redo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Y, id, f_repeat) || (is_osx && Shortcut(ImGuiMod_Shortcut | ImGuiMod_Shift | ImGuiKey_Z, id, f_repeat))) && !is_readonly && is_undoable;
- const bool is_select_all = Shortcut(ImGuiMod_Shortcut | ImGuiKey_A, id);
+ const bool is_cut = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_X, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, id, f_repeat) || Shortcut(ImGuiKey_Cut, id, f_repeat)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
+ const bool is_copy = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_C, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, id) || Shortcut(ImGuiKey_Copy, id, f_repeat)) && !is_password && (!is_multiline || state->HasSelection());
+ const bool is_paste = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_V, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, id, f_repeat) || Shortcut(ImGuiKey_Paste, id, f_repeat)) && !is_readonly;
+ const bool is_undo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Z, id, f_repeat) || Shortcut(ImGuiKey_Undo, id, f_repeat)) && !is_readonly && is_undoable;
+ const bool is_redo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Y, id, f_repeat) || (is_osx && Shortcut(ImGuiMod_Shortcut | ImGuiMod_Shift | ImGuiKey_Z, id, f_repeat)) || Shortcut(ImGuiKey_Redo, id, f_repeat)) && !is_readonly && is_undoable;
+ const bool is_select_all = Shortcut(ImGuiMod_Shortcut | ImGuiKey_A, id) || Shortcut(ImGuiKey_SelectAll, id);
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;