1
0
mirror of synced 2025-01-11 05:42:15 +01:00

fix: ID collision in Jump To menu

This commit is contained in:
WerWolv 2024-12-23 01:00:58 +01:00
parent a1d4545e29
commit 1c3dfc9b2f

View File

@ -1385,13 +1385,17 @@ namespace hex::plugin::builtin {
return (value >= provider->getBaseAddress()) && (value < (provider->getBaseAddress() + provider->getActualSize())); return (value >= provider->getBaseAddress()) && (value < (provider->getBaseAddress() + provider->getActualSize()));
}; };
ImGui::PushID(1);
if (ImGui::MenuItem(hex::format("0x{:08X}", littleEndianValue).c_str(), "hex.ui.common.little_endian"_lang, false, canJumpTo(littleEndianValue))) { if (ImGui::MenuItem(hex::format("0x{:08X}", littleEndianValue).c_str(), "hex.ui.common.little_endian"_lang, false, canJumpTo(littleEndianValue))) {
ImHexApi::HexEditor::setSelection(littleEndianValue, 1); ImHexApi::HexEditor::setSelection(littleEndianValue, 1);
} }
ImGui::PopID();
ImGui::PushID(2);
if (ImGui::MenuItem(hex::format("0x{:08X}", bigEndianValue).c_str(), "hex.ui.common.big_endian"_lang, false, canJumpTo(bigEndianValue))) { if (ImGui::MenuItem(hex::format("0x{:08X}", bigEndianValue).c_str(), "hex.ui.common.big_endian"_lang, false, canJumpTo(bigEndianValue))) {
ImHexApi::HexEditor::setSelection(bigEndianValue, 1); ImHexApi::HexEditor::setSelection(bigEndianValue, 1);
} }
ImGui::PopID();
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.jump_to.curr_pattern"_lang, "", false, selection.has_value() && ContentRegistry::PatternLanguage::getRuntime().getCreatedPatternCount() > 0)) { if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.edit.jump_to.curr_pattern"_lang, "", false, selection.has_value() && ContentRegistry::PatternLanguage::getRuntime().getCreatedPatternCount() > 0)) {
auto patterns = ContentRegistry::PatternLanguage::getRuntime().getPatternsAtAddress(selection->getStartAddress()); auto patterns = ContentRegistry::PatternLanguage::getRuntime().getPatternsAtAddress(selection->getStartAddress());