Skip to content

Commit 901b80f

Browse files
thankyouverycoolawesomekling
authored andcommitted
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.
1 parent 961a225 commit 901b80f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Userland/Libraries/LibGUI/TextEditor.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,10 @@ void TextEditor::paint_event(PaintEvent& event)
754754

755755
Optional<UISize> TextEditor::calculated_min_size() const
756756
{
757-
auto margins = content_margins();
758-
int horizontal = margins.left() + margins.right(),
759-
vertical = margins.top() + margins.bottom();
760-
int vertical_content_size = font().glyph_height() + 4;
761-
if (!is_multi_line() && m_icon)
762-
vertical_content_size = max(vertical_content_size, icon_size() + 2);
763-
return UISize(horizontal, vertical);
757+
if (is_multi_line())
758+
return AbstractScrollableWidget::calculated_min_size();
759+
auto m = content_margins();
760+
return UISize { m.left() + m.right(), m.top() + m.bottom() };
764761
}
765762

766763
void TextEditor::select_all()

0 commit comments

Comments
 (0)