7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 12:01:41 +00:00

Fix wrapping of text in infobar.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19171
This commit is contained in:
Jeff Young 2025-03-11 14:45:38 +00:00
parent d527ce92ca
commit 4a64aa9816

View File

@ -265,10 +265,12 @@ void WX_INFOBAR::onSize( wxSizeEvent& aEvent )
// min height for the control. The min height of the text control will be the size
// of a single line of text. This assumes that two lines of text are larger
// than the height of the icon for the bar.
textCtrl->Wrap( text->GetSize().GetWidth() );
wxString new_text = textCtrl->GetLabel();
int height = ( new_text.Freq( '\n' ) + 1 ) * text->GetMinSize().GetHeight();
SetMinSize( wxSize( GetSize().GetWidth(), height ) );
textCtrl->Wrap( -1 );
wxString wrapped_text = textCtrl->GetLabel();
int height = ( wrapped_text.Freq( '\n' ) + 1 ) * text->GetMinSize().GetHeight();
int margins = text->GetMinSize().GetHeight() - 1;
SetMinSize( wxSize( GetSize().GetWidth(), height + margins ) );
textCtrl->Wrap( -1 );
}
}