From 038b98eacf1594a6f3bef22d72c97e1bb004d25b Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 29 Dec 2023 22:41:12 +0100 Subject: [PATCH] fix: Foreground color not applying to ASCII column Fixes #1477 --- plugins/ui/source/ui/hex_editor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index 71bef3db0..1095ab452 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -499,8 +499,7 @@ namespace hex::ui { this->handleSelection(byteAddress, bytesPerCell, &bytes[x * bytesPerCell], cellHovered); - // Get byte foreground color - + // Set byte foreground color auto popForeground = SCOPE_GUARD { ImGui::PopStyleColor(); }; if (foregroundColor.has_value() && m_editingAddress != byteAddress) ImGui::PushStyleColor(ImGuiCol_Text, *foregroundColor); @@ -554,6 +553,13 @@ namespace hex::ui { this->drawSelectionFrame(x, y, selection, byteAddress, 1, cellStartPos, cellSize, backgroundColor.value()); } + // Set cell foreground color + auto popForeground = SCOPE_GUARD { ImGui::PopStyleColor(); }; + if (foregroundColor.has_value() && m_editingAddress != byteAddress) + ImGui::PushStyleColor(ImGuiCol_Text, *foregroundColor); + else + popForeground.release(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (m_characterCellPadding * 1_scaled) / 2); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); ImGui::PushItemWidth(CharacterSize.x);