1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

TextEditor: Fixed a bug updating the text holder size for single-line editors

This commit is contained in:
ed 2021-04-07 12:31:46 +01:00
parent c7d082e770
commit a533e86044

View file

@ -681,6 +681,16 @@ struct TextEditor::Iterator
return roundToInt (height);
}
int getTextRight()
{
float maxWidth = 0.0f;
while (next())
maxWidth = jmax (maxWidth, atomRight);
return roundToInt (maxWidth);
}
//==============================================================================
int indexInText = 0;
float lineY = 0, lineHeight = 0, maxDescent = 0;
@ -1437,7 +1447,8 @@ void TextEditor::checkLayout()
if (getWordWrapWidth() > 0)
{
auto textBottom = Iterator (*this).getTotalTextHeight() + topIndent;
auto textRight = getMaximumTextWidth() + leftIndent + rightEdgeSpace;
auto textRight = jmax (getMaximumTextWidth() + leftIndent + rightEdgeSpace,
Iterator (*this).getTextRight());
textHolder->setSize (textRight, textBottom);
viewport->setScrollBarsShown (scrollbarVisible