1
0
mirror of synced 2025-01-19 01:24:15 +01:00

impr: Jump to selection in main hex editor as well when clicking on diff entries

This commit is contained in:
WerWolv 2024-07-27 16:52:15 +02:00
parent 4c38fe261d
commit 3cde4472c8

View File

@ -292,10 +292,21 @@ namespace hex::plugin::diffing {
// Draw start address
ImGui::TableNextColumn();
if (ImGui::Selectable(hex::format("0x{:02X}", regionA.start).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) {
a.hexEditor.setSelection({ regionA.start, ((regionA.end - regionA.start) + 1) });
const Region selectionA = { regionA.start, ((regionA.end - regionA.start) + 1) };
const Region selectionB = { regionB.start, ((regionB.end - regionB.start) + 1) };
a.hexEditor.setSelection(selectionA);
a.hexEditor.jumpToSelection();
b.hexEditor.setSelection({ regionB.start, ((regionB.end - regionB.start) + 1) });
b.hexEditor.setSelection(selectionB);
b.hexEditor.jumpToSelection();
const auto &providers = ImHexApi::Provider::getProviders();
auto openProvider = ImHexApi::Provider::get();
if (providers[a.provider] == openProvider)
ImHexApi::HexEditor::setSelection(selectionA);
else if (providers[b.provider] == openProvider)
ImHexApi::HexEditor::setSelection(selectionB);
}
// Draw end address