LibGUI: Update calculated_min_size() for TextEditor
Defer to AbstractScrollableWidget when TextEditor is multi-line. Otherwise, as "vertical_content_size" was unused, simply return margins for now.
This commit is contained in:
parent
961a225316
commit
901b80f988
Notes:
sideshowbarker
2024-07-17 06:39:19 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/901b80f988 Pull-request: https://github.com/SerenityOS/serenity/pull/15344
1 changed files with 4 additions and 7 deletions
|
@ -754,13 +754,10 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
|
||||
Optional<UISize> TextEditor::calculated_min_size() const
|
||||
{
|
||||
auto margins = content_margins();
|
||||
int horizontal = margins.left() + margins.right(),
|
||||
vertical = margins.top() + margins.bottom();
|
||||
int vertical_content_size = font().glyph_height() + 4;
|
||||
if (!is_multi_line() && m_icon)
|
||||
vertical_content_size = max(vertical_content_size, icon_size() + 2);
|
||||
return UISize(horizontal, vertical);
|
||||
if (is_multi_line())
|
||||
return AbstractScrollableWidget::calculated_min_size();
|
||||
auto m = content_margins();
|
||||
return UISize { m.left() + m.right(), m.top() + m.bottom() };
|
||||
}
|
||||
|
||||
void TextEditor::select_all()
|
||||
|
|
Loading…
Add table
Reference in a new issue