// src/buffer/logic.rs
use crossterm::event::{KeyCode, KeyModifiers};
use crate::config::binds::config::Config;
use crate::state::app::state::UiState;

/// Toggle the buffer list visibility based on keybindings.
pub fn toggle_buffer_list(
    ui_state: &mut UiState,
    config: &Config,
    key: KeyCode,
    modifiers: KeyModifiers,
) -> bool {
    if let Some(action) = config.get_common_action(key, modifiers) {
        if action == "toggle_buffer_list" {
            ui_state.show_buffer_list = !ui_state.show_buffer_list;
            return true;
        }
    }
    false
}
