From a3b3eeb56a69b674429c7e5843821430da86c9f6 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 16 Apr 2021 15:59:13 +0200 Subject: [PATCH] ui: Improve how pointers are displayed in pattern data view --- .../libimhex/include/hex/lang/pattern_data.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/libimhex/include/hex/lang/pattern_data.hpp b/plugins/libimhex/include/hex/lang/pattern_data.hpp index 93f72e583..b534a6ec4 100644 --- a/plugins/libimhex/include/hex/lang/pattern_data.hpp +++ b/plugins/libimhex/include/hex/lang/pattern_data.hpp @@ -251,7 +251,7 @@ namespace hex::lang { ImGui::TableNextColumn(); ImGui::Text("0x%04llX", this->getSize()); ImGui::TableNextColumn(); - ImGui::TextColored(ImColor(0xFF9BC64D), "%s*", this->m_pointedAt->getFormattedName().c_str()); + ImGui::TextColored(ImColor(0xFF9BC64D), "%s", this->getFormattedName().c_str()); ImGui::TableNextColumn(); ImGui::Text("*(0x%llX)", data); @@ -283,12 +283,21 @@ namespace hex::lang { return this->m_highlightedAddresses; } [[nodiscard]] std::string getFormattedName() const override { - return "Pointer"; + std::string result = this->m_pointedAt->getFormattedName() + "* : "; + switch (this->getSize()) { + case 1: result += "u8"; break; + case 2: result += "u16"; break; + case 4: result += "u32"; break; + case 8: result += "u64"; break; + case 16: result += "u128"; break; + } + + return result; } void setPointedAtPattern(PatternData *pattern) { this->m_pointedAt = pattern; - this->m_pointedAt->setVariableName("*" + this->m_pointedAt->getVariableName()); + this->m_pointedAt->setVariableName("*" + this->getVariableName()); } [[nodiscard]] PatternData* getPointedAtPattern() {