state: remove overlay widgets on ComponentKill events

pull/144/head
Manos Pitsidianakis 4 years ago
parent eb36034740
commit 4b91de3d59
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

@ -1174,14 +1174,16 @@ impl State {
self.display_messages_pos = self.display_messages.len() - 1;
self.redraw();
}
UIEvent::ComponentKill(ref id) if self.overlay.iter().any(|c| c.id() == *id) => {
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
self.overlay.remove(pos);
}
UIEvent::FinishedUIDialog(ref id, ref mut results)
if self.overlay.iter().any(|c| c.id() == *id) =>
{
if let Some(ref mut action @ Some(_)) = results.downcast_mut::<Option<Action>>() {
self.exec_command(action.take().unwrap());
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
self.overlay.remove(pos);
return;
}
}

Loading…
Cancel
Save