suggestions in the dropdown menu now works amazingly well
This commit is contained in:
@@ -78,16 +78,34 @@ pub fn render_form(
|
||||
|
||||
// --- NEW: RENDER AUTOCOMPLETE ---
|
||||
if form_state.autocomplete_active {
|
||||
if let Some(suggestions) = form_state.get_suggestions() {
|
||||
if let Some(active_rect) = active_field_rect {
|
||||
if !suggestions.is_empty() {
|
||||
// Use the Rect of the active field that render_canvas found for us.
|
||||
if let Some(active_rect) = active_field_rect {
|
||||
let selected_index = form_state.get_selected_suggestion_index();
|
||||
|
||||
// THE DECIDER LOGIC:
|
||||
// 1. Check for rich suggestions first.
|
||||
if let Some(rich_suggestions) = form_state.get_rich_suggestions() {
|
||||
if !rich_suggestions.is_empty() {
|
||||
autocomplete::render_rich_autocomplete_dropdown(
|
||||
f,
|
||||
active_rect,
|
||||
f.area(), // Use f.area() for clamping, not f.size()
|
||||
theme,
|
||||
rich_suggestions,
|
||||
selected_index,
|
||||
);
|
||||
}
|
||||
}
|
||||
// 2. Fallback to simple suggestions if rich ones aren't available.
|
||||
else if let Some(simple_suggestions) = form_state.get_suggestions() {
|
||||
if !simple_suggestions.is_empty() {
|
||||
autocomplete::render_autocomplete_dropdown(
|
||||
f,
|
||||
active_rect,
|
||||
f.area(),
|
||||
theme,
|
||||
suggestions,
|
||||
form_state.get_selected_suggestion_index(),
|
||||
simple_suggestions,
|
||||
selected_index,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user