filter help by current state
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-04-30 22:05:02 +03:00
parent 9f30f77aee
commit daaa4f7bef
2 changed files with 10 additions and 9 deletions

View file

@ -42,20 +42,22 @@ impl Tek {
}
fn view_modal_help (&self) -> impl Content<TuiOut> + use<'_> {
let bindings = ||self.keys.layers.iter().flat_map(|a|a.1)
let bindings = ||self.keys.layers.iter()
.filter_map(|a|(a.0)(self).then_some(a.1))
.flat_map(|a|a)
.filter_map(|x|if let Value::Exp(_, iter)=x.value{
Some(iter)
} else {
None
});
let binding = |mut binding: TokenIter, _|Bsp::e(
Tui::bold(true, Tui::fg(Color::Rgb(255,192,0), if let Some(Token {
Fixed::x(15, Align::w(Tui::bold(true, Tui::fg(Color::Rgb(255,192,0), if let Some(Token {
value: Value::Sym(key), ..
}) = binding.next() {
Some(key.to_string())
} else {
None
})),
})))),
Bsp::e(" ", Tui::fg(Color::Rgb(255,255,255), if let Some(Token {
value: Value::Key(command), ..
}) = binding.next() {
@ -64,8 +66,7 @@ impl Tek {
None
})),
);
let layer = Map::south(1, bindings, binding);
Bsp::s(Tui::bold(true, "Help"), Bsp::s("", layer))
Bsp::s(Tui::bold(true, "Help"), Bsp::s("", Map::south(1, bindings, binding)))
}
pub fn view_status (&self) -> impl Content<TuiOut> + use<'_> {