Simplify nvim version check, remove regex dependency

Using `has("nvim-0.4")` check seems more robust than using a regex to
parse the version string. This also means regex is no longer a runtime
dependency.
macos-click-through
mforsb 3 years ago committed by Keith Simmons
parent 5c90f33e9e
commit e343c64d4e

@ -42,7 +42,6 @@ futures = "0.3.12"
glutin = { git = "https://github.com/Kethku/glutin", branch = "new-keyboard-all" }
winit = { git = "https://github.com/Kethku/winit", branch = "new-keyboard-all", default-features = false }
gl = "0.14.0"
regex = "1.5.4"
swash = "0.1.4"
clap="2.33.3"

@ -21,7 +21,6 @@ use crate::settings::*;
use crate::{cmd_line::CmdLineSettings, error_handling::ResultPanicExplanation};
pub use events::*;
use handler::NeovimHandler;
use regex::Regex;
pub use tx_wrapper::{TxWrapper, WrapTx};
pub use ui_commands::UiCommand;
@ -188,16 +187,13 @@ async fn start_neovim_runtime(
close_watcher_running.store(false, Ordering::Relaxed);
});
if let Ok(output) = nvim.command_output("version").await {
let re = Regex::new(r"NVIM v0.[4-9]\d*.\d+").unwrap();
if !re.is_match(&output) {
match nvim.command_output("echo has('nvim-0.4')").await.as_deref() {
Ok("1") => {} // This is just a guard
_ => {
error!("Neovide requires nvim version 0.4 or higher. Download the latest version here https://github.com/neovim/neovim/wiki/Installing-Neovim");
std::process::exit(0);
}
} else {
error!("Neovide requires nvim version 0.4 or higher. Download the latest version here https://github.com/neovim/neovim/wiki/Installing-Neovim");
std::process::exit(0);
};
}
nvim.set_var("neovide", Value::Boolean(true))
.await

Loading…
Cancel
Save