generated from GarandPLG/rust-flake-template
Track window area and refactor keybinding APIs
- Track terminal size in `App::window_area` and update on resize - Accept action slices in `count_largest_group` and `KeybindingsWidget::new` - Add ACTIONS slices and layout helpers for default, main_menu, skirmish - Add `main_menu_option_helper` for formatting menu strings and export it
This commit is contained in:
@@ -284,7 +284,7 @@ pub fn event_to_action(event: &KeyEvent) -> Option<Action> {
|
||||
/// It counts how many times each group appears in the supplied actions and
|
||||
/// returns the highest count. This can be used, for example, to size UI
|
||||
/// elements that display groups of bindings.
|
||||
pub fn count_largest_group(actions: &Vec<Action>) -> u16 {
|
||||
pub fn count_largest_group(actions: &[Action]) -> u16 {
|
||||
let mut group_counts: HashMap<Group, u16> = HashMap::new();
|
||||
|
||||
for action in actions {
|
||||
|
||||
Reference in New Issue
Block a user