Skip to content

Commit

Permalink
draw_colored_text should do even less work when the text is empty
Browse files Browse the repository at this point in the history
Co-authored-by: Zhilkin Serg <[email protected]>
  • Loading branch information
db48x and ZhilkinSerg authored Aug 18, 2024
1 parent 692d169 commit d90f282
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,15 @@ void cataimgui::draw_colored_text( std::string const &text, nc_color &color,
void cataimgui::draw_colored_text( std::string const &text,
float wrap_width, bool *is_selected, bool *is_focused, bool *is_hovered )
{
if( text.empty() ) {
ImGui::NewLine();
return;
}

ImGui::PushID( text.c_str() );
int startColorStackCount = GImGui->ColorStack.Size;
ImGuiID itemId = GImGui->CurrentWindow->IDStack.back();

if( text.empty() ) {
ImGui::NewLine( );
}

size_t chars_per_line = size_t( wrap_width );
if( chars_per_line == 0 ) {
chars_per_line = SIZE_MAX;
Expand Down

0 comments on commit d90f282

Please sign in to comment.