disabling modes where they shouldnt be enabled BIG UPDATE
This commit is contained in:
@@ -87,14 +87,12 @@ impl Config {
|
||||
&self,
|
||||
is_edit_mode: bool,
|
||||
command_mode: bool,
|
||||
show_general_mode: bool,
|
||||
key: KeyCode,
|
||||
modifiers: KeyModifiers
|
||||
) -> Option<&str> {
|
||||
match (show_general_mode, command_mode, is_edit_mode) {
|
||||
(true, _, _) => self.get_general_action(key, modifiers),
|
||||
(_, true, _) => self.get_command_action_for_key(key, modifiers),
|
||||
(_, _, true) => self.get_edit_action_for_key(key, modifiers)
|
||||
match (command_mode, is_edit_mode) {
|
||||
(true, _) => self.get_command_action_for_key(key, modifiers),
|
||||
(_, true) => self.get_edit_action_for_key(key, modifiers)
|
||||
.or_else(|| self.get_common_action(key, modifiers)),
|
||||
_ => self.get_read_only_action_for_key(key, modifiers)
|
||||
.or_else(|| self.get_common_action(key, modifiers))
|
||||
|
||||
@@ -55,7 +55,7 @@ impl EventHandler {
|
||||
let modifiers = key.modifiers;
|
||||
|
||||
// Handle general mode (replaces intro and admin)
|
||||
if app_state.ui.show_general_mode {
|
||||
if app_state.ui.show_intro || app_state.ui.show_admin {
|
||||
if let Some(action) = config.get_general_action(key_code, modifiers) {
|
||||
match action {
|
||||
"move_up" => {
|
||||
@@ -75,8 +75,11 @@ impl EventHandler {
|
||||
return Ok((false, String::new()));
|
||||
}
|
||||
"select" => {
|
||||
// Handle selection based on current view
|
||||
app_state.ui.show_general_mode = false;
|
||||
if app_state.ui.show_intro {
|
||||
app_state.ui.show_intro = false;
|
||||
} else if app_state.ui.show_admin {
|
||||
app_state.ui.show_admin = false;
|
||||
}
|
||||
return Ok((false, "Selected".to_string()));
|
||||
}
|
||||
"toggle_sidebar" => {
|
||||
@@ -179,7 +182,6 @@ impl EventHandler {
|
||||
let context_action = config.get_action_for_current_context(
|
||||
self.is_edit_mode,
|
||||
self.command_mode,
|
||||
app_state.ui.show_general_mode,
|
||||
key_code,
|
||||
modifiers
|
||||
);
|
||||
|
||||
@@ -8,7 +8,6 @@ pub struct UiState {
|
||||
pub is_saved: bool,
|
||||
pub show_intro: bool,
|
||||
pub show_admin: bool,
|
||||
pub show_general_mode: bool,
|
||||
}
|
||||
|
||||
pub struct GeneralState {
|
||||
@@ -65,7 +64,6 @@ impl Default for UiState {
|
||||
is_saved: false,
|
||||
show_intro: true,
|
||||
show_admin: false,
|
||||
show_general_mode: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user