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