From 7c6a22d3e14df685d75d45e2c6470c6d2b85f5d1 Mon Sep 17 00:00:00 2001 From: veeso Date: Sun, 21 Mar 2021 12:56:31 +0100 Subject: [PATCH] Fixed msgbox wrap --- src/ui/layout/components/msgbox.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ui/layout/components/msgbox.rs b/src/ui/layout/components/msgbox.rs index e35bf46..2199108 100644 --- a/src/ui/layout/components/msgbox.rs +++ b/src/ui/layout/components/msgbox.rs @@ -90,19 +90,17 @@ impl Component for MsgBox { Color::Reset => self.props.background, _ => line.bg, }; - let mut spans: Vec = Vec::new(); let message_row = textwrap::wrap(line.content.as_str(), area.width as usize); for msg in message_row.iter() { - spans.push(Span::styled( + lines.push(ListItem::new(Spans::from(vec![Span::styled( align_text_center(msg, area.width), Style::default() .add_modifier(line.get_modifiers()) .fg(line_fg) .bg(line_bg), - )); + )]))); } - lines.push(ListItem::new(Spans::from(spans))); } lines }