From 9074a6fcf14c203be16da68c6f50a31742ec4cfc Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 9 Nov 2022 18:49:07 +0100 Subject: [PATCH] fix: Edit menu items being always unavailable --- lib/libimhex/include/hex/api/imhex_api.hpp | 2 +- plugins/builtin/source/content/events.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libimhex/include/hex/api/imhex_api.hpp b/lib/libimhex/include/hex/api/imhex_api.hpp index ea48188af..290d8f258 100644 --- a/lib/libimhex/include/hex/api/imhex_api.hpp +++ b/lib/libimhex/include/hex/api/imhex_api.hpp @@ -83,7 +83,7 @@ namespace hex { std::map &getTooltips(); std::map &getTooltipFunctions(); - void setCurrentSelection(ProviderRegion region); + void setCurrentSelection(std::optional region); } u32 addBackgroundHighlight(const Region ®ion, color_t color); diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 0bf44b6fd..96a994668 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -123,6 +123,10 @@ namespace hex::plugin::builtin { ProviderExtraData::erase(provider); }); + EventManager::subscribe([](const ImHexApi::HexEditor::ProviderRegion ®ion) { + ImHexApi::HexEditor::impl::setCurrentSelection(region); + }); + fs::setFileBrowserErrorCallback([]{ #if defined(NFD_PORTAL) View::showErrorPopup("hex.builtin.popup.error.file_dialog.portal"_lang);