|
|
@ -2,27 +2,21 @@
|
|
|
|
pub mod layouts;
|
|
|
|
pub mod layouts;
|
|
|
|
|
|
|
|
|
|
|
|
mod events;
|
|
|
|
mod events;
|
|
|
|
mod ui_commands;
|
|
|
|
|
|
|
|
mod handler;
|
|
|
|
mod handler;
|
|
|
|
|
|
|
|
mod ui_commands;
|
|
|
|
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use std::env;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::process::Stdio;
|
|
|
|
use std::process::Stdio;
|
|
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
|
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
|
|
|
use std::sync::mpsc::{Receiver, Sender};
|
|
|
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::thread;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
|
|
|
|
use std::os::windows::process::CommandExt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crossfire::mpsc::{TxUnbounded, RxUnbounded};
|
|
|
|
use crossfire::mpsc::{RxUnbounded, TxUnbounded};
|
|
|
|
use log::{error, info, warn};
|
|
|
|
use log::{error, info, warn};
|
|
|
|
use nvim_rs::{create::tokio as create, UiAttachOptions};
|
|
|
|
use nvim_rs::{create::tokio as create, UiAttachOptions};
|
|
|
|
use rmpv::Value;
|
|
|
|
use rmpv::Value;
|
|
|
|
use tokio::process::Command;
|
|
|
|
use tokio::process::Command;
|
|
|
|
use tokio::runtime::Runtime;
|
|
|
|
use tokio::runtime::Runtime;
|
|
|
|
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use crate::error_handling::ResultPanicExplanation;
|
|
|
|
use crate::error_handling::ResultPanicExplanation;
|
|
|
|
use crate::settings::*;
|
|
|
|
use crate::settings::*;
|
|
|
@ -122,8 +116,7 @@ async fn start_neovim_runtime(
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
let (width, height) = window_geometry_or_default();
|
|
|
|
let (width, height) = window_geometry_or_default();
|
|
|
|
let handler = NeovimHandler::new(ui_command_sender.clone(), redraw_event_sender.clone());
|
|
|
|
let handler = NeovimHandler::new(ui_command_sender.clone(), redraw_event_sender.clone());
|
|
|
|
let (mut nvim, io_handler, _) =
|
|
|
|
let (mut nvim, io_handler, _) = create::new_child_cmd(&mut create_nvim_command(), handler)
|
|
|
|
create::new_child_cmd(&mut create_nvim_command(), handler)
|
|
|
|
|
|
|
|
.await
|
|
|
|
.await
|
|
|
|
.unwrap_or_explained_panic("Could not locate or start neovim process");
|
|
|
|
.unwrap_or_explained_panic("Could not locate or start neovim process");
|
|
|
|
|
|
|
|
|
|
|
@ -231,7 +224,9 @@ async fn start_neovim_runtime(
|
|
|
|
|
|
|
|
|
|
|
|
let mut options = UiAttachOptions::new();
|
|
|
|
let mut options = UiAttachOptions::new();
|
|
|
|
options.set_linegrid_external(true);
|
|
|
|
options.set_linegrid_external(true);
|
|
|
|
|
|
|
|
if env::args().any(|arg| arg == "--multiGrid") || env::var("NeovideMultiGrid").is_ok() {
|
|
|
|
options.set_multigrid_external(true);
|
|
|
|
options.set_multigrid_external(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
options.set_rgb(true);
|
|
|
|
options.set_rgb(true);
|
|
|
|
nvim.ui_attach(width as i64, height as i64, &options)
|
|
|
|
nvim.ui_attach(width as i64, height as i64, &options)
|
|
|
|
.await
|
|
|
|
.await
|
|
|
@ -276,11 +271,14 @@ pub fn start_bridge(
|
|
|
|
ui_command_sender: TxUnbounded<UiCommand>,
|
|
|
|
ui_command_sender: TxUnbounded<UiCommand>,
|
|
|
|
ui_command_receiver: RxUnbounded<UiCommand>,
|
|
|
|
ui_command_receiver: RxUnbounded<UiCommand>,
|
|
|
|
redraw_event_sender: TxUnbounded<RedrawEvent>,
|
|
|
|
redraw_event_sender: TxUnbounded<RedrawEvent>,
|
|
|
|
running: Arc<AtomicBool>
|
|
|
|
running: Arc<AtomicBool>,
|
|
|
|
) -> Bridge {
|
|
|
|
) -> Bridge {
|
|
|
|
let runtime = Runtime::new().unwrap();
|
|
|
|
let runtime = Runtime::new().unwrap();
|
|
|
|
runtime.spawn(start_neovim_runtime(ui_command_sender, ui_command_receiver, redraw_event_sender, running));
|
|
|
|
runtime.spawn(start_neovim_runtime(
|
|
|
|
Bridge {
|
|
|
|
ui_command_sender,
|
|
|
|
_runtime: runtime
|
|
|
|
ui_command_receiver,
|
|
|
|
}
|
|
|
|
redraw_event_sender,
|
|
|
|
|
|
|
|
running,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
Bridge { _runtime: runtime }
|
|
|
|
}
|
|
|
|
}
|
|
|
|