T60: each fallback picker is keyed by its input, not its place, since Ely's combobox keeps its state by id and listens to the input it first met; after a removal moved the inputs, a picker keyed by place wrote another row's family into its new input at the next blur

This commit is contained in:
ZacharyZhang-NY committed 2026-10-19 17:48:06 -04:00
1 parent 885aa4bda0
commit 5d131e51d8
3 files changed
+9 -4

No files matched your search

+7 -2
View File
@@ -212,7 +212,7 @@ impl SettingsWindow {
)
};
let rows = families.iter().enumerate().map(|(index, family)| {
let picker = FontPicker::new(("font_fallback", index), &self.fallbacks[index])
let picker = FontPicker::new(keyed(&self.fallbacks[index]), &self.fallbacks[index])
.selected(family.clone())
.on_change(pick(&this, index));
let remove = IconButton::new(("remove_fallback", index), IconName::X).on_click({
@@ -233,7 +233,7 @@ impl SettingsWindow {
});
let next = families.len();
let add = if self.adding {
let picker = FontPicker::new(("font_fallback", next), &self.fallbacks[next])
let picker = FontPicker::new(keyed(&self.fallbacks[next]), &self.fallbacks[next])
.on_change(pick(&this, next));
let cancel = IconButton::new("cancel_fallback", IconName::X).on_click({
let this = this.clone();
@@ -296,6 +296,11 @@ impl SettingsWindow {
}
}
/// A fallback picker's id, its input's: Ely's combobox keeps state by id and listens to the input it met first.
fn keyed(input: &Entity<TextInput>) -> (&'static str, u64) {
("font_fallback", input.entity_id().as_u64())
}
/// Saves the family picked at fallback `index`, past the last adds one; a refusal shows the saved family again, the list closed.
fn pick(
this: &Entity<SettingsWindow>,