fix(dropdown): refresh popup when selections change
This commit is contained in:
parent
7eecbe30d7
commit
fc85fcac3e
1 changed files with 8 additions and 0 deletions
|
|
@ -178,6 +178,8 @@ where
|
||||||
fn diff(&mut self, tree: &mut Tree) {
|
fn diff(&mut self, tree: &mut Tree) {
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
|
let mut selections_changed = state.selections.len() != self.selections.len();
|
||||||
|
|
||||||
state
|
state
|
||||||
.selections
|
.selections
|
||||||
.resize_with(self.selections.len(), crate::Plain::default);
|
.resize_with(self.selections.len(), crate::Plain::default);
|
||||||
|
|
@ -192,6 +194,7 @@ where
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selections_changed = true;
|
||||||
state.hashes[i] = text_hash;
|
state.hashes[i] = text_hash;
|
||||||
state.selections[i].update(Text {
|
state.selections[i].update(Text {
|
||||||
content: selection.as_ref(),
|
content: selection.as_ref(),
|
||||||
|
|
@ -206,6 +209,11 @@ where
|
||||||
wrapping: text::Wrapping::default(),
|
wrapping: text::Wrapping::default(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if state.is_open.load(Ordering::SeqCst) && selections_changed {
|
||||||
|
state.close_operation = true;
|
||||||
|
state.open_operation = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size(&self) -> Size<Length> {
|
fn size(&self) -> Size<Length> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue