From 74f17fd638dac9f1d1e1dc131258ccea184ded7d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 25 Jul 2022 11:33:30 +0200 Subject: [PATCH] ui: Properly hide hidden patterns in hex editor view --- .../builtin/source/content/views/view_pattern_editor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 4a27c25d5..cd1b7a5ba 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -236,6 +236,9 @@ namespace hex::plugin::builtin { std::optional color; for (const auto &pattern : ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address)) { + if (pattern->isHidden()) + continue; + if (color.has_value()) color = ImAlphaBlendColors(*color, pattern->getColor()); else @@ -249,9 +252,12 @@ namespace hex::plugin::builtin { hex::unused(data, size); auto patterns = ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address); - if (!patterns.empty()) { + if (!patterns.empty() && !std::all_of(patterns.begin(), patterns.end(), [](const auto &pattern) { return pattern->isHidden(); })) { ImGui::BeginTooltip(); for (const auto &pattern : patterns) { + if (pattern->isHidden()) + continue; + auto tooltipColor = (pattern->getColor() & 0x00FF'FFFF) | 0x7000'0000; ImGui::PushID(pattern); if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {