tab is triggering the suggestion dropdown menu, but ctrl+n and ctrl+p only cycle through it
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::state::pages::form::FormState;
|
||||
use crate::functions::modes::edit::{auth_e, form_e};
|
||||
use crate::modes::handlers::event::EventOutcome;
|
||||
use crate::state::state::AppState;
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||
|
||||
pub async fn handle_edit_event(
|
||||
key: KeyEvent,
|
||||
@@ -82,24 +82,19 @@ pub async fn handle_edit_event(
|
||||
if let Some(action) = config.get_edit_action_for_key(key.code, key.modifiers) {
|
||||
// --- Special Handling for Tab/Shift+Tab in Role Field ---
|
||||
if app_state.ui.show_register && register_state.current_field() == 4 {
|
||||
match action {
|
||||
"suggestion_up" | "suggestion_down" => { // Mapped to Tab/Shift+Tab
|
||||
if !register_state.in_suggestion_mode {
|
||||
register_state.update_role_suggestions();
|
||||
if !register_state.role_suggestions.is_empty() {
|
||||
register_state.in_suggestion_mode = true;
|
||||
register_state.selected_suggestion_index = Some(0);
|
||||
return Ok("Suggestions shown".to_string());
|
||||
} else {
|
||||
return Ok("No suggestions available".to_string());
|
||||
}
|
||||
}
|
||||
if !register_state.in_suggestion_mode && key.code == KeyCode::Tab && key.modifiers == KeyModifiers::NONE {
|
||||
register_state.update_role_suggestions();
|
||||
if !register_state.role_suggestions.is_empty() {
|
||||
register_state.in_suggestion_mode = true;
|
||||
register_state.selected_suggestion_index = Some(0); // Select first suggestion
|
||||
return Ok("Suggestions shown".to_string());
|
||||
} else {
|
||||
return Ok("No suggestions available".to_string());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
// --- End Special Handling ---
|
||||
|
||||
|
||||
return if app_state.ui.show_login {
|
||||
auth_e::execute_edit_action(
|
||||
action,
|
||||
|
||||
Reference in New Issue
Block a user