Text boxes: Return full word even if it doesn't fit in the column width

It does mean that the text now can be outside the text box, but this is
better than an infinite loop.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10668
This commit is contained in:
Roberto Fernandez Bautista 2022-01-30 14:31:11 +00:00
parent 64f2adbc31
commit 6cf170c2c9
1 changed files with 13 additions and 6 deletions

View File

@ -454,17 +454,24 @@ void FONT::LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aSi
aText += " "; aText += " ";
lineWidth += spaceWidth; lineWidth += spaceWidth;
} }
aText += words[jj].first;
lineWidth += words[jj].second;
jj++;
} }
else else if( lineWidth > 0 )
{ {
aText += '\n'; aText += '\n';
lineWidth = 0; lineWidth = 0;
continue;
} }
else
{
// TODO: Would we want to further split the words into characters when it doesn't fit
// in the column width? For now just return the full word even if it doesn't fit
// to avoid an infinite loop.
}
aText += words[jj].first;
lineWidth += words[jj].second;
jj++;
} }
} }
} }