| 1 | use helix_event::register_hook; |
| 2 | use helix_view::events::DocumentFocusLost; |
| 3 | use helix_view::handlers::Handlers; |
| 4 | |
| 5 | use crate::job::{self}; |
| 6 | use crate::ui; |
| 7 | |
| 8 | pub(super) fn register_hooks(_handlers: &Handlers) { |
| 9 | register_hook!(move |_event: &mut DocumentFocusLost<'_>| { |
| 10 | job::dispatch_blocking(move |_, compositor| { |
| 11 | if compositor.find::<ui::Prompt>().is_some() { |
| 12 | compositor.remove_type::<ui::Prompt>(); |
| 13 | } |
| 14 | }); |
| 15 | Ok(()) |
| 16 | }); |
| 17 | } |