1
0
mirror of synced 2025-01-18 17:14:13 +01:00

fix: Copy-as options not being disabled correctly

This commit is contained in:
WerWolv 2023-05-12 08:38:07 +02:00
parent 0321743f1e
commit 18bc5de169
3 changed files with 11 additions and 1 deletions

View File

@ -172,6 +172,11 @@ namespace hex {
*/
bool isSelectionValid();
/**
* @brief Clears the current selection in the Hex Editor
*/
void clearSelection();
/**
* @brief Gets the current selection in the Hex Editor
* @return The current selection

View File

@ -177,6 +177,10 @@ namespace hex {
return impl::s_currentSelection;
}
void clearSelection() {
impl::s_currentSelection.reset();
}
void setSelection(const Region &region, prv::Provider *provider) {
setSelection(ProviderRegion { region, provider == nullptr ? Provider::get() : provider });
}

View File

@ -1043,8 +1043,9 @@ namespace hex::plugin::builtin {
auto selection = ImHexApi::HexEditor::getSelection();
auto provider = ImHexApi::Provider::get();
bool enabled = ImHexApi::HexEditor::isSelectionValid();
for (const auto &[unlocalizedName, callback] : ContentRegistry::DataFormatter::impl::getEntries()) {
if (ImGui::MenuItem(LangEntry(unlocalizedName))) {
if (ImGui::MenuItem(LangEntry(unlocalizedName), nullptr, false, enabled)) {
ImGui::SetClipboardText(
callback(
provider,