fix: Jump to certain array-member patterns not working

Fixes #2398
This commit is contained in:
WerWolv
2025-08-11 21:46:47 +02:00
parent 09b2e20a3d
commit 25c8f4b588
2 changed files with 24 additions and 1 deletions

View File

@@ -983,7 +983,30 @@ namespace hex::ui {
ImGui::TableNextColumn();
ImGui::TableNextColumn();
bool shouldOpen = false;
if (m_jumpToPattern != nullptr) {
if (m_jumpToPattern == &pattern) {
ImGui::SetScrollHereY();
m_jumpToPattern = nullptr;
}
else {
auto parent = m_jumpToPattern->getParent();
while (parent != nullptr) {
if (&pattern == parent) {
ImGui::SetScrollHereY();
shouldOpen = true;
break;
}
parent = parent->getParent();
}
}
}
chunkOpen = highlightWhenSelected(startOffset, ((endOffset + endSize) - startOffset) - 1, [&]{
if (shouldOpen)
ImGui::SetNextItemOpen(true, ImGuiCond_Always);
ImGui::PushStyleVarX(ImGuiStyleVar_FramePadding, 0.0F);
const auto result = ImGui::TreeNodeEx(fmt::format("##TreeNode_{:X}", endOffset).c_str(), ImGuiTreeNodeFlags_DrawLinesToNodes | ImGuiTreeNodeFlags_SpanLabelWidth | ImGuiTreeNodeFlags_OpenOnArrow);
ImGui::PopStyleVar();