fixed decorators behavior in ListView in case of None selection
@@ -70,9 +70,11 @@ impl<M: MessageData, C: Control<M, C>> ListView<M, C> {
}
fn sync_decorators(&self, ui: &UserInterface<M, C>) {
- if let Some(selected_index) = self.selected_index {
for (i, &container) in self.item_containers.iter().enumerate() {
- let select = i == selected_index;
+ let select = match self.selected_index {
+ None => false,
+ Some(selected_index) => i == selected_index,
+ };
if let UINode::ListViewItem(container) = ui.node(container) {
let mut stack = container.children().to_vec();
while let Some(handle) = stack.pop() {
@@ -93,7 +95,6 @@ impl<M: MessageData, C: Control<M, C>> ListView<M, C> {
}
}
}
-}
#[derive(Clone)]
pub struct ListViewItem<M: MessageData, C: Control<M, C>> {
