Fix Control minimum size check too aggressive#116343
Merged
Merged
Conversation
YeldhamDev
approved these changes
Feb 16, 2026
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CodeTextEditor changes the RichTextLabel's minimum size based on its content height when it resizes. This causes it to resize again with a different content height and it continues going back and forth between 2 values.
RichTextLabel can have a different content height even if only the minimum size height changes, because the scrollbar may show or not depending on if it fits. There is also no reserve scrollbar mode like ScrollContainer has.
The error RichTextLabel changes size and causes its minimum height to be set which calls
Control::update_minimum_size()thenControl::_update_minimum_size(), which causes the size to change again. But this time the HBoxContainer it is in gets resorted beforeControl::_update_minimum_size()is called since it is deferred. The HBoxContainer resort updates the size which sets the minimum height again back to the original value. Previously (before #115596) it would then just be ignored since it has the same value as before, even though it changed and its effects got overridden. So in some ways it would be correct to update the size again in this case, but it also allows infinite loops to happen.In the future, RichTextLabel should probably be able to reserve the scrollbar space or do something for when it is at minimum size, since it isn't great at either of the values it is trying to use.

At the lower height (26) without a scrollbar, you can see the
E r rtext go outside of its rect (4.6, this PR):And at the higher height (62) with a scrollbar, the scrollbar cannot move and the text is on one line (master, increasing size causes the freeze):

It looks like there are also cases where the change in #115596 updates the size where it isn't necessary, its too aggressive in updating sizes. So I am reverting that change and implementing a different fix for #109497 that only affects Controls that are made invisible but also doesn't resize them when invisible.