diff --git a/src/widget/dropdown/widget.rs b/src/widget/dropdown/widget.rs index 47df9b89..a5612ccd 100644 --- a/src/widget/dropdown/widget.rs +++ b/src/widget/dropdown/widget.rs @@ -178,6 +178,8 @@ where fn diff(&mut self, tree: &mut Tree) { let state = tree.state.downcast_mut::(); + let mut selections_changed = state.selections.len() != self.selections.len(); + state .selections .resize_with(self.selections.len(), crate::Plain::default); @@ -192,6 +194,7 @@ where continue; } + selections_changed = true; state.hashes[i] = text_hash; state.selections[i].update(Text { content: selection.as_ref(), @@ -206,6 +209,11 @@ where 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 {