From cda55e0f7d7e0e0b35b058d63f2828768094a4e5 Mon Sep 17 00:00:00 2001 From: daa Date: Sat, 14 Oct 2017 14:50:13 +0300 Subject: [PATCH] Make ui attach really async --- src/shell.rs | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/shell.rs b/src/shell.rs index b5a177c..8d2cce9 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -766,25 +766,19 @@ fn init_nvim_async( }); // attach ui - let mut nvim = Some(nvim); - glib::idle_add(move || { - let mut nvim = nvim.take().unwrap(); - if let Err(err) = nvim::post_start_init( - &mut nvim, - options.open_path.as_ref(), - cols as u64, - rows as u64, - ) - { - show_nvim_init_error(&err, state_arc.clone()); - } else { - let mut state = state_arc.borrow_mut(); - state.nvim.borrow_mut().set_initialized(nvim); - state.cursor.as_mut().unwrap().start(); - } - - Continue(false) - }); + if let Err(err) = nvim::post_start_init( + &mut nvim, + options.open_path.as_ref(), + cols as u64, + rows as u64, + ) + { + show_nvim_init_error(&err, state_arc.clone()); + } else { + let mut state = state_arc.borrow_mut(); + state.nvim.borrow_mut().set_initialized(nvim); + state.cursor.as_mut().unwrap().start(); + } } fn draw_initializing(state: &State, ctx: &cairo::Context) {