fix: Foreground color not applying to ASCII column

Fixes #1477
This commit is contained in:
WerWolv 2023-12-29 22:41:12 +01:00
parent 3592d17c93
commit 038b98eacf
1 changed files with 8 additions and 2 deletions

View File

@ -499,8 +499,7 @@ namespace hex::ui {
this->handleSelection(byteAddress, bytesPerCell, &bytes[x * bytesPerCell], cellHovered); this->handleSelection(byteAddress, bytesPerCell, &bytes[x * bytesPerCell], cellHovered);
// Get byte foreground color // Set byte foreground color
auto popForeground = SCOPE_GUARD { ImGui::PopStyleColor(); }; auto popForeground = SCOPE_GUARD { ImGui::PopStyleColor(); };
if (foregroundColor.has_value() && m_editingAddress != byteAddress) if (foregroundColor.has_value() && m_editingAddress != byteAddress)
ImGui::PushStyleColor(ImGuiCol_Text, *foregroundColor); ImGui::PushStyleColor(ImGuiCol_Text, *foregroundColor);
@ -554,6 +553,13 @@ namespace hex::ui {
this->drawSelectionFrame(x, y, selection, byteAddress, 1, cellStartPos, cellSize, backgroundColor.value()); 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::SetCursorPosX(ImGui::GetCursorPosX() + (m_characterCellPadding * 1_scaled) / 2);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::PushItemWidth(CharacterSize.x); ImGui::PushItemWidth(CharacterSize.x);