generated from GarandPLG/rust-flake-template
Add Settings view, widget, and keybindings
Introduce Settings view handling in key events and widgets. Add `Enter` action with its keybinding. Refactor keybinding lookup to use `Option<&KeyBinding>` for missing entries. Update view option generation to safely filter possible values. Export `settings_keybindings` and `settings_widget` from their modules.
This commit is contained in:
1 parent
7226a09bb4
commit
d563bbc966
9 files changed
+123
-27
No files matched your search
@@ -26,9 +26,15 @@ impl KeybindingsWidget {
|
||||
|
||||
let grouped_lines: Vec<Line<'_>> = keybindings
|
||||
.iter()
|
||||
.filter(|b| b.group == group)
|
||||
.map(|b| {
|
||||
Line::from_iter([b.symbol.red().bold(), " - ".into(), b.description.into()])
|
||||
.filter(|b| b.as_ref().map_or(false, |kb| kb.group == group))
|
||||
.filter_map(|b| {
|
||||
b.as_ref().map(|kb| {
|
||||
Line::from_iter([
|
||||
kb.symbol.red().bold(),
|
||||
" - ".into(),
|
||||
kb.description.into(),
|
||||
])
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
Reference in new issue
Block a user