fix: Edit -> Create Bookmark shortcut creating bookmark at wrong address

This commit is contained in:
WerWolv
2022-07-23 21:17:17 +02:00
parent c618eec843
commit daffa4e555
2 changed files with 2 additions and 5 deletions

View File

@@ -250,14 +250,11 @@ namespace hex::plugin::builtin {
}); });
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.edit", 1050, [&] { ContentRegistry::Interface::addMenuItem("hex.builtin.menu.edit", 1050, [&] {
auto provider = ImHexApi::Provider::get();
bool providerValid = ImHexApi::Provider::isValid(); bool providerValid = ImHexApi::Provider::isValid();
auto selection = ImHexApi::HexEditor::getSelection(); auto selection = ImHexApi::HexEditor::getSelection();
if (ImGui::MenuItem("hex.builtin.menu.edit.bookmark"_lang, nullptr, false, selection.has_value() && providerValid)) { if (ImGui::MenuItem("hex.builtin.menu.edit.bookmark"_lang, nullptr, false, selection.has_value() && providerValid)) {
auto base = provider->getBaseAddress(); ImHexApi::Bookmarks::add(selection->getStartAddress(), selection->getSize(), {}, {});
ImHexApi::Bookmarks::add(base + selection->getStartAddress(), selection->size, {}, {});
} }
}); });

View File

@@ -286,7 +286,7 @@ namespace hex::plugin::builtin {
auto region = ImHexApi::HexEditor::getSelection(); auto region = ImHexApi::HexEditor::getSelection();
if (region.has_value()) if (region.has_value())
ImHexApi::Bookmarks::add(region->address, region->size, {}, {}); ImHexApi::Bookmarks::add(region->getStartAddress(), region->getSize(), {}, {});
} }
} }
ImGui::EndDisabled(); ImGui::EndDisabled();