Fix incorrect language selected in language selector (#21648)
Due to filtering after enumeration, initial candidate ids are assigned incorrectly. This later causes the wrong item to be picked up when accessed via index in the vector.
This commit is contained in:
parent
304158ed79
commit
e5251f4091
1 changed files with 4 additions and 3 deletions
|
@ -104,14 +104,15 @@ impl LanguageSelectorDelegate {
|
|||
let candidates = language_registry
|
||||
.language_names()
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.filter_map(|(candidate_id, name)| {
|
||||
.filter_map(|name| {
|
||||
language_registry
|
||||
.available_language_for_name(&name)?
|
||||
.hidden()
|
||||
.not()
|
||||
.then(|| StringMatchCandidate::new(candidate_id, name))
|
||||
.then_some(name)
|
||||
})
|
||||
.enumerate()
|
||||
.map(|(candidate_id, name)| StringMatchCandidate::new(candidate_id, name))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue