-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Fix RenderEditable.computeMaxIntrinsicWidth error return. #82286
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
Fix RenderEditable.computeMaxIntrinsicWidth error return. #82286
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! Could you add a test to verify that if you layout a RenderEditable
with the exact width getMaxIntrinsicWidth
gave you, the render editable does not have a second line?
@@ -3123,7 +3123,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { | |||
@override | |||
double computeMaxIntrinsicWidth(double height) { | |||
_layoutText(maxWidth: double.infinity); | |||
return _textPainter.maxIntrinsicWidth + cursorWidth; | |||
return _textPainter.maxIntrinsicWidth + _caretMargin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add this to computeMinIntrinsicWidth
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About this I am not very clear, @justinmc how to think about it?
I don't think it's necessary, and in fact the real problem is not the wrong line break. |
That means if you layout the |
It does look like it needs to be increased, but I found at 9161ec4 that justin doesn't have the computeMinIntrinsicWidth, so I'm a little unsure. |
Yeah looking at the implementation of |
Awesome, thanks for the explanation. So we should be able to merge this pr now? |
…e.computeMaxIntrinsicWidth
close #82277
Because _kCaretGap is not calculated in RenderEditable.computeMaxIntrinsicWidth, an incorrect with may be returned.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.