Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Wrong column width with reused widget in last column #59816

Merged
merged 2 commits into from
Aug 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,8 @@ std::string widget::layout( const avatar &ava, unsigned int max_width, int label
std::vector<int> widths;
unsigned int total_width = 0;
std::string debug_widths;
for( const widget_id &wid : wgts ) {
for( size_t i = 0; i < wgts.size(); i++ ) {
const widget_id &wid = wgts[i];
widget cur_child = wid.obj();
int cur_width = child_width;
// determine spacing based on type of column
Expand All @@ -1690,7 +1691,7 @@ std::string widget::layout( const avatar &ava, unsigned int max_width, int label
cur_width = cur_child._width;
}
// if last widget make it take the remaining space
if( wid == wgts.back() ) {
if( i == wgts.size() - 1 ) {
cur_width = avail_width - total_width;
mlange-42 marked this conversation as resolved.
Show resolved Hide resolved
}
} else { //columns
Expand All @@ -1711,7 +1712,6 @@ std::string widget::layout( const avatar &ava, unsigned int max_width, int label
total_width += cur_width;
}
if( total_width > max_width ) {

debugmsg( string_format( "widget layout is wider (%d) than sidebar allows (%d) for %s.",
total_width, max_width, debug_widths ) );
}
Expand Down