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

feat: Added full pattern path to hex editor hover tooltip

This commit is contained in:
WerWolv 2024-05-31 17:02:46 +02:00
parent 8a289d2e4f
commit 3049590b68

View File

@ -1470,11 +1470,38 @@ namespace hex::plugin::builtin {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGuiExt::TextFormatted("{} ", "Path");
ImGui::TableNextColumn();
std::string path;
{
std::vector<std::string> pathSegments;
const pl::ptrn::Pattern *entry = pattern;
while (entry != nullptr) {
pathSegments.push_back(entry->getVariableName());
entry = entry->getParent();
}
for (const auto &segment : pathSegments | std::views::reverse) {
if (!segment.starts_with('['))
path += '.';
path += segment;
}
if (path.starts_with('.'))
path = path.substr(1);
}
ImGuiExt::TextFormatted(" {}", path);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGuiExt::TextFormatted("{} ", "hex.ui.common.type"_lang);
ImGui::TableNextColumn();
ImGuiExt::TextFormatted(" {}", pattern->getTypeName());
ImGuiExt::TextFormatted(" {}", pattern->getFormattedName());
ImGui::TableNextRow();
ImGui::TableNextColumn();