properly handling up and down in the form and login, login needs logic implementation
This commit is contained in:
@@ -52,7 +52,8 @@ pub async fn handle_read_only_event(
|
||||
|
||||
// Try to match the current sequence against Read-Only mode bindings
|
||||
if let Some(action) = config.matches_key_sequence_generalized(&sequence) {
|
||||
let result = if (action == "previous_entry" || action == "next_entry") && app_state.ui.show_form {
|
||||
let result = if (action == "previous_entry" || action == "next_entry" ||
|
||||
action == "move_up" || action == "move_down") && app_state.ui.show_form {
|
||||
crate::tui::functions::form::handle_action(
|
||||
action,
|
||||
form_state,
|
||||
@@ -61,27 +62,6 @@ pub async fn handle_read_only_event(
|
||||
total_count,
|
||||
ideal_cursor_column,
|
||||
).await?
|
||||
} else if action == "move_up" && app_state.ui.show_form {
|
||||
crate::tui::functions::form::handle_move_up(
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
).await?
|
||||
} else if action == "move_down" && app_state.ui.show_form {
|
||||
crate::tui::functions::form::handle_move_down(
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
).await?
|
||||
} else if (action == "move_up" || action == "move_down") && app_state.ui.show_login {
|
||||
// Assuming you have a auth_state in the app_state that can be accessed
|
||||
if action == "move_up" {
|
||||
crate::tui::functions::login::handle_move_up(
|
||||
&mut app_state.auth_state,
|
||||
).await?
|
||||
} else {
|
||||
crate::tui::functions::login::handle_move_down(
|
||||
&mut app_state.auth_state,
|
||||
).await?
|
||||
}
|
||||
} else {
|
||||
execute_action(
|
||||
action,
|
||||
@@ -187,12 +167,12 @@ async fn execute_action(
|
||||
"previous_entry" | "next_entry" => {
|
||||
// This will only be called when no component is active
|
||||
key_sequence_tracker.reset();
|
||||
Ok(format!("Navigation only available in form mode"))
|
||||
Ok(format!("Navigation prev/next only available in form mode"))
|
||||
}
|
||||
"move_up" | "move_down" => {
|
||||
// This will only be called when no component is active
|
||||
key_sequence_tracker.reset();
|
||||
Ok(format!("Navigation only available in active component"))
|
||||
Ok(format!("Navigation up/down only available in form mode"))
|
||||
}
|
||||
"exit_edit_mode" => {
|
||||
key_sequence_tracker.reset();
|
||||
|
||||
Reference in New Issue
Block a user