fn fill_controllers()

in below/view/src/help_menu.rs [112:168]


fn fill_controllers(
    v: &mut SelectView<String>,
    event_controllers: Rc<RefCell<HashMap<Event, Controllers>>>,
) {
    // event_controllers can generate helper messages in completely random order base on
    // user's customization. Instead of using it directly, we will generate a cmd-msg map
    // to ensure the order.
    let cmd_map: HashMap<Controllers, ControllerHelper> = event_controllers
        .borrow()
        .iter()
        .map(|(event, controller)| {
            (
                controller.clone(),
                ControllerHelper {
                    event: event.clone(),
                    cmd: controller.command(),
                    cmd_short: controller.cmd_shortcut(),
                    description: get_description(controller),
                    args: get_args(controller),
                },
            )
        })
        .collect();

    // Unwrap in this vec! must be sccuess, otherwise we may have lost controller(s) and should be detected
    // by unit test.
    let mut controllers = vec![
        cmd_map.get(&Controllers::Help).unwrap().to_string(),
        cmd_map.get(&Controllers::CmdPalette).unwrap().to_string(),
        cmd_map.get(&Controllers::Quit).unwrap().to_string(),
        cmd_map.get(&Controllers::Left).unwrap().to_string(),
        cmd_map.get(&Controllers::Right).unwrap().to_string(),
        cmd_map.get(&Controllers::NextTab).unwrap().to_string(),
        cmd_map.get(&Controllers::PrevTab).unwrap().to_string(),
        cmd_map.get(&Controllers::NextCol).unwrap().to_string(),
        cmd_map.get(&Controllers::PrevCol).unwrap().to_string(),
        cmd_map.get(&Controllers::JForward).unwrap().to_string(),
        cmd_map.get(&Controllers::JBackward).unwrap().to_string(),
        cmd_map.get(&Controllers::NSample).unwrap().to_string(),
        cmd_map.get(&Controllers::PSample).unwrap().to_string(),
        cmd_map.get(&Controllers::Pause).unwrap().to_string(),
        cmd_map.get(&Controllers::SortCol).unwrap().to_string(),
        cmd_map.get(&Controllers::Filter).unwrap().to_string(),
        cmd_map.get(&Controllers::CFilter).unwrap().to_string(),
        cmd_map.get(&Controllers::Zoom).unwrap().to_string(),
        cmd_map.get(&Controllers::Fold).unwrap().to_string(),
        cmd_map.get(&Controllers::Process).unwrap().to_string(),
        cmd_map.get(&Controllers::Cgroup).unwrap().to_string(),
        cmd_map.get(&Controllers::System).unwrap().to_string(),
        cmd_map.get(&Controllers::NextPage).unwrap().to_string(),
        cmd_map.get(&Controllers::PrevPage).unwrap().to_string(),
    ];

    controllers.extend(crate::get_extra_controller_str(&cmd_map));

    v.add_all_str(controllers);
}