From 176ce1f4b90e0fd929ddbaddfd74eef301dc5d91 Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Fri, 20 Sep 2024 00:11:23 +0530 Subject: [PATCH] Seperate style and title variables (#537) Added lj's thought process from https://github.com/ChrisTitusTech/linutil/pull/490 Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> --- tui/src/state.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tui/src/state.rs b/tui/src/state.rs index f3e1c5741..fa980a409 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -237,22 +237,16 @@ impl AppState { Style::new() }; + let title = format!( + "Linux Toolbox - {} {}", + env!("BUILD_DATE"), + self.multi_select.then(|| "[Multi-Select]").unwrap_or("") + ); + // Create the list widget with items let list = List::new(items) - .highlight_style(if let Focus::List = self.focus { - Style::default().reversed() - } else { - Style::new() - }) - .block(Block::default().borders(Borders::ALL).title(format!( - "Linux Toolbox - {} {}", - env!("BUILD_DATE"), - if self.multi_select { - "[Multi-Select]" - } else { - "" - } - ))) + .highlight_style(style) + .block(Block::default().borders(Borders::ALL).title(title)) .scroll_padding(1); frame.render_stateful_widget(list, chunks[1], &mut self.selection);