tab is triggering the suggestion dropdown menu, but ctrl+n and ctrl+p only cycle through it

This commit is contained in:
filipriec
2025-04-12 23:56:14 +02:00
parent 149949ad99
commit 5e101bef14
4 changed files with 26 additions and 26 deletions

View File

@@ -311,7 +311,7 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
register_state.selected_suggestion_index = Some(if current_index >= max_index { 0 } else { current_index + 1 });
Ok("Suggestion changed down".to_string())
}
"suggestion_up" if register_state.show_role_suggestions => {
"suggestion_up" if register_state.in_suggestion_mode => {
let max_index = register_state.role_suggestions.len().saturating_sub(1);
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) });
@@ -336,10 +336,12 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
register_state.in_suggestion_mode = false;
Ok("Suggestions hidden".to_string())
}
_ => Ok("".to_string()) // Action doesn't apply in this state (e.g., suggestions not shown)
"suggestion_down" | "suggestion_up" | "select_suggestion" => {
Ok("Suggestion action ignored: Not in suggestion mode.".to_string())
}
_ => Ok("".to_string())
}
} else {
// Action received but not applicable to the current field
Ok("".to_string())
}
} else {