From 3c0ea731640c4d498f880dbc401899a701e36cb7 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Mon, 26 Feb 2024 10:38:45 +0100 Subject: [PATCH] patch: Improve selection filter rendering --- bin/commands/patch/flux/select/ui.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/commands/patch/flux/select/ui.rs b/bin/commands/patch/flux/select/ui.rs index 7e2248a6..54b25c67 100644 --- a/bin/commands/patch/flux/select/ui.rs +++ b/bin/commands/patch/flux/select/ui.rs @@ -369,7 +369,19 @@ impl Render<()> for Patches { }, ); - let filter = span::default(self.props.filter.to_string()).magenta().dim(); + let filter = if !self.props.filter.to_string().is_empty() { + Line::from( + [ + span::badge("▼".to_string()), + span::default(" ".to_string()), + span::default(self.props.filter.to_string()).magenta().dim(), + ] + .to_vec(), + ) + } else { + Line::from([span::blank()].to_vec()) + }; + let stats = Line::from( [ span::default(self.props.stats.get("Draft").unwrap_or(&0).to_string()).dim(), @@ -399,14 +411,8 @@ impl Render<()> for Patches { frame, layout[2], FooterProps { - cells: [ - span::badge("/".to_string()).into(), - filter.into(), - stats.into(), - progress.clone().into(), - ], + cells: [filter.into(), stats.into(), progress.clone().into()], widths: [ - Constraint::Length(3), Constraint::Fill(1), Constraint::Fill(1), Constraint::Length(progress.width() as u16),