diff --git a/plugins/builtin/include/content/views/view_find.hpp b/plugins/builtin/include/content/views/view_find.hpp index f2fb4f033..8c052c970 100644 --- a/plugins/builtin/include/content/views/view_find.hpp +++ b/plugins/builtin/include/content/views/view_find.hpp @@ -110,7 +110,7 @@ namespace hex::plugin::builtin { static std::tuple, size_t> parseNumericValueInput(const std::string &input, SearchSettings::Value::Type type); void runSearch(); - std::string decodeValue(prv::Provider *provider, Occurrence occurrence) const; + std::string decodeValue(prv::Provider *provider, Occurrence occurrence, size_t maxBytes = 0xFFFF'FFFF) const; }; } \ No newline at end of file diff --git a/plugins/builtin/source/content/views/view_find.cpp b/plugins/builtin/source/content/views/view_find.cpp index 07753fd67..9d4970191 100644 --- a/plugins/builtin/source/content/views/view_find.cpp +++ b/plugins/builtin/source/content/views/view_find.cpp @@ -51,7 +51,7 @@ namespace hex::plugin::builtin { ImGui::TableNextColumn(); { - const auto value = this->decodeValue(ImHexApi::Provider::get(), occurrence.value); + const auto value = this->decodeValue(ImHexApi::Provider::get(), occurrence.value, 256); ImGui::ColorButton("##color", ImColor(HighlightColor())); ImGui::SameLine(0, 10); @@ -63,7 +63,7 @@ namespace hex::plugin::builtin { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang.get()); + ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang); ImGui::TableNextColumn(); ImGui::TextFormatted("[ 0x{:08X} - 0x{:08X} ]", occurrence.value.region.getStartAddress(), occurrence.value.region.getEndAddress()); @@ -72,7 +72,7 @@ namespace hex::plugin::builtin { if (value != demangledValue) { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::TextFormatted("{}: ", "hex.builtin.view.find.demangled"_lang.get()); + ImGui::TextFormatted("{}: ", "hex.builtin.view.find.demangled"_lang); ImGui::TableNextColumn(); ImGui::TextFormatted("{}", demangledValue); } @@ -516,8 +516,8 @@ namespace hex::plugin::builtin { }); } - std::string ViewFind::decodeValue(prv::Provider *provider, Occurrence occurrence) const { - std::vector bytes(std::min(occurrence.region.getSize(), 128)); + std::string ViewFind::decodeValue(prv::Provider *provider, Occurrence occurrence, size_t maxBytes) const { + std::vector bytes(std::min(occurrence.region.getSize(), maxBytes)); provider->read(occurrence.region.getStartAddress(), bytes.data(), bytes.size()); std::string result; @@ -559,6 +559,9 @@ namespace hex::plugin::builtin { break; } + if (occurrence.region.getSize() > maxBytes) + result += "..."; + return result; } @@ -815,7 +818,7 @@ namespace hex::plugin::builtin { } ImGui::PopItemWidth(); - if (ImGui::BeginTable("##entries", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { + if (ImGui::BeginTable("##entries", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupColumn("hex.builtin.common.offset"_lang, 0, -1, ImGui::GetID("offset")); ImGui::TableSetupColumn("hex.builtin.common.size"_lang, 0, -1, ImGui::GetID("size")); @@ -867,7 +870,7 @@ namespace hex::plugin::builtin { ImGui::PushID(i); - auto value = this->decodeValue(provider, foundItem); + auto value = this->decodeValue(provider, foundItem, 256); ImGui::TextFormatted("{}", value); ImGui::SameLine(); if (ImGui::Selectable("##line", false, ImGuiSelectableFlags_SpanAllColumns))