sidebar as a feature
This commit is contained in:
@@ -6,33 +6,19 @@ use crate::state::app::state::UiState;
|
||||
pub struct UiStateHandler;
|
||||
|
||||
impl UiStateHandler {
|
||||
pub fn toggle_sidebar(
|
||||
|
||||
pub fn toggle_buffer_list(
|
||||
ui_state: &mut UiState,
|
||||
config: &Config,
|
||||
key: KeyCode,
|
||||
modifiers: KeyModifiers,
|
||||
) -> bool {
|
||||
if let Some(action) = config.get_action_for_key_in_mode(&config.keybindings.common, key, modifiers) {
|
||||
if action == "toggle_sidebar" {
|
||||
ui_state.show_sidebar = !ui_state.show_sidebar;
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ use crate::components::{
|
||||
common::dialog::render_dialog,
|
||||
common::find_file_palette,
|
||||
common::search_palette::render_search_palette,
|
||||
handlers::sidebar::{self, calculate_sidebar_layout},
|
||||
intro::intro::render_intro,
|
||||
render_background,
|
||||
render_command_line,
|
||||
render_status_line,
|
||||
};
|
||||
use crate::sidebar::{calculate_sidebar_layout, render_sidebar};
|
||||
use crate::buffer::render_buffer_list;
|
||||
use crate::config::colors::themes::Theme;
|
||||
use crate::modes::general::command_navigation::NavigationState;
|
||||
@@ -168,7 +168,7 @@ pub fn render_ui(
|
||||
let (sidebar_area, form_actual_area) =
|
||||
calculate_sidebar_layout(app_state.ui.show_sidebar, main_content_area);
|
||||
if let Some(sidebar_rect) = sidebar_area {
|
||||
sidebar::render_sidebar(
|
||||
render_sidebar(
|
||||
f,
|
||||
sidebar_rect,
|
||||
theme,
|
||||
|
||||
Reference in New Issue
Block a user