Highlight the active filter

This commit is contained in:
mo8it 2024-04-28 23:21:13 +02:00
parent aedeff8b24
commit 1508938fed

View file

@ -2,7 +2,7 @@ use anyhow::{Context, Result};
use ratatui::{ use ratatui::{
layout::{Constraint, Rect}, layout::{Constraint, Rect},
style::{Style, Stylize}, style::{Style, Stylize},
text::Span, text::{Line, Span},
widgets::{Block, Borders, HighlightSpacing, Paragraph, Row, Table, TableState}, widgets::{Block, Borders, HighlightSpacing, Paragraph, Row, Table, TableState},
Frame, Frame,
}; };
@ -193,11 +193,25 @@ impl<'a> UiState<'a> {
let message = if self.message.is_empty() { let message = if self.message.is_empty() {
// Help footer. // Help footer.
Span::raw( let mut spans = Vec::with_capacity(4);
"↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter <d>one/<p>ending │ <q>uit", spans.push(Span::raw(
) "↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter ",
));
match self.filter {
Filter::Done => {
spans.push("<d>one".underlined().magenta());
spans.push(Span::raw("/<p>ending"));
}
Filter::Pending => {
spans.push(Span::raw("<d>one/"));
spans.push("<p>ending".underlined().magenta());
}
Filter::None => spans.push(Span::raw("<d>one/<p>ending")),
}
spans.push(Span::raw(" │ <q>uit"));
Line::from(spans)
} else { } else {
self.message.as_str().light_blue() Line::from(self.message.as_str().light_blue())
}; };
frame.render_widget( frame.render_widget(
message, message,