still not working autocomplete
This commit is contained in:
@@ -309,13 +309,13 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
|
|||||||
let max_index = register_state.role_suggestions.len().saturating_sub(1);
|
let max_index = register_state.role_suggestions.len().saturating_sub(1);
|
||||||
let current_index = register_state.selected_suggestion_index.unwrap_or(0);
|
let current_index = register_state.selected_suggestion_index.unwrap_or(0);
|
||||||
register_state.selected_suggestion_index = Some(if current_index >= max_index { 0 } else { current_index + 1 });
|
register_state.selected_suggestion_index = Some(if current_index >= max_index { 0 } else { current_index + 1 });
|
||||||
Ok("Suggestion changed".to_string())
|
Ok("Suggestion changed down".to_string())
|
||||||
}
|
}
|
||||||
"suggestion_up" if register_state.show_role_suggestions => {
|
"suggestion_up" if register_state.show_role_suggestions => {
|
||||||
let max_index = register_state.role_suggestions.len().saturating_sub(1);
|
let max_index = register_state.role_suggestions.len().saturating_sub(1);
|
||||||
let current_index = register_state.selected_suggestion_index.unwrap_or(0);
|
let current_index = register_state.selected_suggestion_index.unwrap_or(0);
|
||||||
register_state.selected_suggestion_index = Some(if current_index == 0 { max_index } else { current_index.saturating_sub(1) });
|
register_state.selected_suggestion_index = Some(if current_index == 0 { max_index } else { current_index.saturating_sub(1) });
|
||||||
Ok("Suggestion changed".to_string())
|
Ok("Suggestion changed up".to_string())
|
||||||
}
|
}
|
||||||
"select_suggestion" if register_state.show_role_suggestions => {
|
"select_suggestion" if register_state.show_role_suggestions => {
|
||||||
if let Some(selected_index) = register_state.selected_suggestion_index {
|
if let Some(selected_index) = register_state.selected_suggestion_index {
|
||||||
|
|||||||
@@ -115,9 +115,7 @@ pub async fn handle_edit_event(
|
|||||||
|
|
||||||
// Character insertion
|
// Character insertion
|
||||||
if let KeyCode::Char(_) = key.code {
|
if let KeyCode::Char(_) = key.code {
|
||||||
// --- Autocomplete Trigger on Char Insert ---
|
|
||||||
let is_role_field = app_state.ui.show_register && register_state.current_field() == 4;
|
let is_role_field = app_state.ui.show_register && register_state.current_field() == 4;
|
||||||
let result = // Store result before potential update
|
|
||||||
// --- End Autocomplete Trigger ---
|
// --- End Autocomplete Trigger ---
|
||||||
|
|
||||||
return if app_state.ui.show_login {
|
return if app_state.ui.show_login {
|
||||||
@@ -156,7 +154,6 @@ pub async fn handle_edit_event(
|
|||||||
if is_role_field {
|
if is_role_field {
|
||||||
register_state.update_role_suggestions();
|
register_state.update_role_suggestions();
|
||||||
}
|
}
|
||||||
return result; // Return the result from execute_edit_action
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Backspace/Delete for Autocomplete Trigger
|
// Handle Backspace/Delete for Autocomplete Trigger
|
||||||
|
|||||||
Reference in New Issue
Block a user