Browse Source

state: remove overlay widgets on ComponentKill events

jmap-eventsource
Manos Pitsidianakis 1 year ago
parent
commit
4b91de3d59
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 6
      src/state.rs

6
src/state.rs

@ -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