|
|
@ -54,9 +54,9 @@ fn create_nvim_command() -> Command {
|
|
|
|
struct NeovimHandler(Arc<Mutex<Editor>>);
|
|
|
|
struct NeovimHandler(Arc<Mutex<Editor>>);
|
|
|
|
|
|
|
|
|
|
|
|
impl Clone for NeovimHandler {
|
|
|
|
impl Clone for NeovimHandler {
|
|
|
|
fn clone(&self) -> Self {
|
|
|
|
fn clone(&self) -> Self {
|
|
|
|
NeovimHandler(Arc::clone(&self.0))
|
|
|
|
NeovimHandler(Arc::clone(&self.0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
#[async_trait]
|
|
|
@ -95,17 +95,17 @@ async fn start_nvim(editor: Arc<Mutex<Editor>>, receiver: Arc<Mutex<Receiver<UiC
|
|
|
|
.unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process");
|
|
|
|
.unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process");
|
|
|
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
loop {
|
|
|
|
let receiver = receiver.clone();
|
|
|
|
let receiver = receiver.clone();
|
|
|
|
let r = spawn_blocking(move || {
|
|
|
|
let r = spawn_blocking(move || {
|
|
|
|
let receiver = receiver.lock().unwrap();
|
|
|
|
let receiver = receiver.lock().unwrap();
|
|
|
|
receiver.recv()
|
|
|
|
receiver.recv()
|
|
|
|
}).await.expect("Could not await blocking call");
|
|
|
|
}).await.expect("Could not await blocking call");
|
|
|
|
|
|
|
|
|
|
|
|
if let Ok(ui_command) = r {
|
|
|
|
if let Ok(ui_command) = r {
|
|
|
|
ui_command.execute(&nvim).await;
|
|
|
|
ui_command.execute(&nvim).await;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -117,7 +117,7 @@ fn main() {
|
|
|
|
let editor_clone = editor.clone();
|
|
|
|
let editor_clone = editor.clone();
|
|
|
|
let receiver = Arc::new(Mutex::new(receiver));
|
|
|
|
let receiver = Arc::new(Mutex::new(receiver));
|
|
|
|
rt.spawn(async move {
|
|
|
|
rt.spawn(async move {
|
|
|
|
start_nvim(editor_clone, receiver).await;
|
|
|
|
start_nvim(editor_clone, receiver).await;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
ui_loop(editor, sender, (INITIAL_WIDTH, INITIAL_HEIGHT));
|
|
|
|
ui_loop(editor, sender, (INITIAL_WIDTH, INITIAL_HEIGHT));
|
|
|
|
}
|
|
|
|
}
|
|
|
|