much better, still not it

This commit is contained in:
filipriec
2025-04-12 15:52:12 +02:00
parent 50a329fc0d
commit f4d234089f
2 changed files with 36 additions and 28 deletions

View File

@@ -100,12 +100,15 @@ pub fn render_canvas(
if let Some(input_rect) = active_field_input_rect {
let selected_index = form_state.get_selected_suggestion_index();
// Calculate dropdown area below the active input field
let dropdown_height = (suggestions.len() as u16).min(5) + 2; // Max 5 suggestions + border
// --- Calculate Compact Dropdown Size ---
let max_suggestion_width = suggestions.iter().map(|s| s.len()).max().unwrap_or(0) as u16;
let dropdown_width = max_suggestion_width.max(10); // Use longest suggestion width, min 10
let dropdown_height = (suggestions.len() as u16).min(5); // Height matches suggestion count, max 5
// --- End Size Calculation ---
let dropdown_area = Rect {
x: input_rect.x,
y: input_rect.y + 1, // Position below the input line
width: input_rect.width.max(20), // Ensure minimum width
y: input_rect.y + 1,
width: dropdown_width,
height: dropdown_height,
};