1
0
mirror of synced 2024-11-12 18:20:52 +01:00

ui: Enable undo and redo menu items only if that action is available

This commit is contained in:
WerWolv 2022-03-26 17:21:51 +01:00
parent 29fb1de882
commit 0f0a836fa0

View File

@ -794,9 +794,9 @@ namespace hex::plugin::builtin {
void ViewHexEditor::drawEditPopup() {
auto provider = ImHexApi::Provider::get();
bool providerValid = ImHexApi::Provider::isValid();
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.undo"_lang, "CTRL + Z", false, providerValid))
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.undo"_lang, "CTRL + Z", false, providerValid && provider->canUndo()))
provider->undo();
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.redo"_lang, "CTRL + Y", false, providerValid))
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.redo"_lang, "CTRL + Y", false, providerValid && provider->canRedo()))
provider->redo();
ImGui::Separator();