1
0
mirror of synced 2024-11-28 09:30:51 +01:00

fix: Highlighting not updating correctly when changing bookmark region

Fixes #1591
This commit is contained in:
WerWolv 2024-03-11 14:00:52 +01:00
parent 0186f2f456
commit 3d592dbc79

View File

@ -313,8 +313,8 @@ namespace hex::plugin::builtin {
u64 droppedBookmarkId = *static_cast<const u64*>(payload->Data); u64 droppedBookmarkId = *static_cast<const u64*>(payload->Data);
// Find the correct bookmark with that id // Find the correct bookmark with that id
auto droppedIter = std::ranges::find_if(m_bookmarks->begin(), m_bookmarks->end(), [droppedBookmarkId](const auto &bookmark) { auto droppedIter = std::ranges::find_if(m_bookmarks->begin(), m_bookmarks->end(), [droppedBookmarkId](const auto &bookmarkItem) {
return bookmark.entry.id == droppedBookmarkId; return bookmarkItem.entry.id == droppedBookmarkId;
}); });
// Swap the two bookmarks // Swap the two bookmarks
@ -412,16 +412,25 @@ namespace hex::plugin::builtin {
u64 end = region.getEndAddress(); u64 end = region.getEndAddress();
if (!locked) { if (!locked) {
bool updated = false;
ImGui::PushItemWidth(100_scaled); ImGui::PushItemWidth(100_scaled);
ImGuiExt::InputHexadecimal("##begin", &begin); if (ImGuiExt::InputHexadecimal("##begin", &begin))
updated = true;
ImGui::SameLine(0, 0); ImGui::SameLine(0, 0);
ImGui::TextUnformatted(" - "); ImGui::TextUnformatted(" - ");
ImGui::SameLine(0, 0); ImGui::SameLine(0, 0);
ImGuiExt::InputHexadecimal("##end", &end);
if (ImGuiExt::InputHexadecimal("##end", &end))
updated = true;
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if (end > begin) if (updated && end > begin) {
region = Region(begin, end - begin + 1); region = Region(begin, end - begin + 1);
EventHighlightingChanged::post();
}
} else { } else {
ImGuiExt::TextFormatted("0x{:02X} - 0x{:02X}", begin, end); ImGuiExt::TextFormatted("0x{:02X} - 0x{:02X}", begin, end);
} }