working suggestions but position is wrong

This commit is contained in:
filipriec
2025-04-12 16:22:07 +02:00
parent f4d234089f
commit 7b27d00972
4 changed files with 22 additions and 58 deletions

View File

@@ -81,16 +81,12 @@ impl RegisterState {
/// Updates role suggestions based on current input.
pub fn update_role_suggestions(&mut self) {
let current_input = self.role.to_lowercase();
if current_input.is_empty() {
self.role_suggestions = AVAILABLE_ROLES.to_vec();
} else {
self.role_suggestions = AVAILABLE_ROLES
.iter()
.filter(|r| r.to_lowercase().starts_with(&current_input))
.cloned()
.collect();
self.show_role_suggestions = !self.role_suggestions.is_empty();
}
self.role_suggestions = AVAILABLE_ROLES
.iter()
.filter(|role| role.to_lowercase().contains(&current_input))
.cloned()
.collect();
self.show_role_suggestions = !self.role_suggestions.is_empty();
}
}