Skip to content

Commit e2590f7

Browse files
authored
better default for single line textinput size (#2070)
1 parent 286283d commit e2590f7

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/components/textinput.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -621,19 +621,21 @@ impl DrawableComponent for TextInputComponent {
621621
if let Some(ta) = &self.textarea {
622622
let area = if self.embed {
623623
rect
624+
} else if self.input_type == InputType::Multiline {
625+
let area = ui::centered_rect(60, 20, f.size());
626+
ui::rect_inside(
627+
Size::new(10, 3),
628+
f.size().into(),
629+
area,
630+
)
624631
} else {
625-
match self.input_type {
626-
InputType::Multiline => {
627-
let area =
628-
ui::centered_rect(60, 20, f.size());
629-
ui::rect_inside(
630-
Size::new(10, 3),
631-
f.size().into(),
632-
area,
633-
)
634-
}
635-
_ => ui::centered_rect_absolute(32, 3, f.size()),
636-
}
632+
let area = ui::centered_rect(60, 1, f.size());
633+
634+
ui::rect_inside(
635+
Size::new(10, 3),
636+
Size::new(f.size().width, 3),
637+
area,
638+
)
637639
};
638640

639641
f.render_widget(Clear, area);

0 commit comments

Comments
 (0)