Skip to content

Commit

Permalink
Merge pull request #1 from katemonster33/refactor-draw_colored_text-2
Browse files Browse the repository at this point in the history
Colors pushed to ImGui color stack get popped back off
  • Loading branch information
db48x authored May 19, 2024
2 parents 24616b2 + 5e1467a commit 4767a3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ void cataimgui::window::draw_colored_text( std::string const &text,
float wrap_width, bool *is_selected, bool *is_focused, bool *is_hovered )
{
ImGui::PushID( text.c_str() );
int startColorStackCount = GImGui->ColorStack.Size;
ImGuiID itemId = GImGui->CurrentWindow->IDStack.back();
size_t chars_per_line = size_t( wrap_width );
if( chars_per_line == 0 ) {
Expand Down Expand Up @@ -472,7 +473,10 @@ void cataimgui::window::draw_colored_text( std::string const &text,

}
}

for( int curColorStackCount = GImGui->ColorStack.Size; curColorStackCount > startColorStackCount;
curColorStackCount-- ) {
ImGui::PopStyleColor();
}
ImGui::PopID();
}

Expand Down

0 comments on commit 4767a3d

Please sign in to comment.