From 47aa6d2e96b9e31b856bc5e5eb559f02e6c7b6cd Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Wed, 12 Apr 2023 10:25:24 +0200 Subject: [PATCH] One more clean up fix --- src/tui/ui.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 997b473..0600687 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -242,11 +242,12 @@ impl Ui { }) } - fn block<'a>() -> Block<'a> { + fn block<'a>(title: &str) -> Block<'a> { Block::default() .title_alignment(Alignment::Center) .borders(Borders::ALL) .border_type(BorderType::Rounded) + .title(format!(" {title} ")) } fn render_list_widget( @@ -260,7 +261,7 @@ impl Ui { .highlight_style(Self::highlight_style(list.active)) .highlight_symbol(">> ") .style(Self::style()) - .block(Self::block().title(format!(" {title} "))), + .block(Self::block(title)), area, &mut list.state, ); @@ -273,9 +274,7 @@ impl Ui { frame: &mut Frame<'_, B>, ) { frame.render_widget( - paragraph - .style(Self::style()) - .block(Self::block().title(format!(" {title} "))), + paragraph.style(Self::style()).block(Self::block(title)), area, ); }