From 2f6764539098092c204ea357a460dfdc101855e2 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 6 Feb 2020 06:07:31 -0800 Subject: [PATCH] fix init error freeze --- src/bridge/mod.rs | 12 +++++++----- src/settings.rs | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index 16a08d7..b836d21 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -94,10 +94,9 @@ async fn start_process(mut receiver: UnboundedReceiver) { .unwrap_or_explained_panic("Could not attach ui to neovim process"); info!("Neovim process attached"); - nvim.set_option("lazyredraw", Value::Boolean(false)).await - .ok(); - let nvim = Arc::new(nvim); + + let input_nvim = nvim.clone(); tokio::spawn(async move { info!("UiCommand processor started"); while let Some(commands) = drain(&mut receiver).await { @@ -109,14 +108,17 @@ async fn start_process(mut receiver: UnboundedReceiver) { .into_iter().last().into_iter() .chain(other_commands.into_iter()) { - let nvim = nvim.clone(); + let input_nvim = input_nvim.clone(); tokio::spawn(async move { trace!("Executing UiCommand: {:?}", &command); - command.execute(&nvim).await; + command.execute(&input_nvim).await; }); } } }); + + nvim.set_option("lazyredraw", Value::Boolean(false)).await + .ok(); } pub struct Bridge { diff --git a/src/settings.rs b/src/settings.rs index 95da4a0..57555f8 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -8,6 +8,7 @@ lazy_static! { pub struct Settings { pub neovim_arguments: Vec, + pub no_idle: AtomicBool, pub buffer_frames: AtomicU16 }