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

View file

@ -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);