post doesnt work, but refactored code displays the autocomplete at least, needs fix

This commit is contained in:
filipriec
2025-06-16 16:42:25 +02:00
parent a9c4527318
commit b30fef4ccd
4 changed files with 149 additions and 167 deletions

View File

@@ -78,25 +78,25 @@ pub fn render_form(
// --- NEW: RENDER AUTOCOMPLETE ---
if form_state.autocomplete_active {
// 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(
// CHANGE THIS to call the renamed function
autocomplete::render_hit_autocomplete_dropdown(
f,
active_rect,
f.area(), // Use f.area() for clamping, not f.size()
f.area(),
theme,
rich_suggestions,
selected_index,
form_state,
);
}
}
// 2. Fallback to simple suggestions if rich ones aren't available.
// The fallback to simple suggestions is now correctly handled
// because the original render_autocomplete_dropdown exists again.
else if let Some(simple_suggestions) = form_state.get_suggestions() {
if !simple_suggestions.is_empty() {
autocomplete::render_autocomplete_dropdown(
@@ -112,3 +112,4 @@ pub fn render_form(
}
}
}