diff --git a/src/cursive.rs b/src/cursive.rs index bec555d..4a0fede 100644 --- a/src/cursive.rs +++ b/src/cursive.rs @@ -419,6 +419,28 @@ impl Cursive { .push(Callback::from_fn(cb)); } + /// Removes any callback tied to the given event. + /// + /// # Examples + /// + /// ```rust,no_run + /// # extern crate cursive; + /// # use cursive::*; + /// # fn main() { + /// let mut siv = Cursive::new(); + /// + /// siv.add_global_callback('q', |s| s.quit()); + /// siv.clear_global_callbacks('q'); + /// # } + /// ``` + pub fn clear_global_callbacks(&mut self, event: E) + where + E: Into, + { + let event = event.into(); + self.global_callbacks.remove(&event); + } + /// Add a layer to the current screen. /// /// # Examples