Skip to content

Commit

Permalink
Fix wrapping in ma details menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Dec 12, 2024
1 parent b2d4809 commit 7f63c4f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/martialarts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2406,8 +2406,8 @@ void ma_details_ui_impl::init_data()

void ma_details_ui_impl::draw_ma_details_text() const
{
// TODO: Need to make proper width calculations
const float window_width_in_chars = window_width * 0.4;
// FIXME: Additional characters for a vertical scroll bar
const float window_width_in_chars = window_width - ImGui::CalcTextSize( "X" ).x * 3;

if( !general_info_text.empty() &&
ImGui::CollapsingHeader( _( "General info" ),
Expand Down Expand Up @@ -2449,7 +2449,9 @@ void ma_details_ui_impl::draw_ma_details_text() const
for( const auto &entry : weapons_text ) {
cataimgui::draw_colored_text( string_format( _( "<header>%s</header>" ), entry.first ) );
ImGui::NewLine();
cataimgui::draw_colored_text( entry.second, window_width_in_chars );
cataimgui::TextColoredParagraph( c_white, entry.second );
// FIXME: Additional line is required because otherwise text from previous line overlaps separator.
ImGui::NewLine();
ImGui::Separator();
}
}
Expand Down

0 comments on commit 7f63c4f

Please sign in to comment.