From 8e57752e973ff04515e850b32b2e611e5f7e2e82 Mon Sep 17 00:00:00 2001 From: daa84 Date: Thu, 24 Mar 2016 12:21:27 +0300 Subject: [PATCH] Event loop --- Cargo.lock | 14 +++++++++++--- Cargo.toml | 5 ++++- Makefile | 2 +- build.rs | 3 +-- src/main.rs | 2 +- src/nvim.rs | 6 +++++- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 385cee3..38fd74d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ dependencies = [ "cairo-rs 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "neovim-lib 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neovim-lib 0.1.0", "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -193,10 +193,18 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "neovim-lib" -version = "0.1.0" +name = "log" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "neovim-lib" +version = "0.1.0" +dependencies = [ + "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serialize 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 790a99d..2183d13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,12 @@ build = "build.rs" [dependencies] cairo-rs = "0.0.8" glib = "0.0.8" -neovim-lib = "0.1" +#neovim-lib = "0.1" rmp = "0.7" +[dependencies.neovim-lib] +path = "../neovim-lib/" + [dependencies.gtk] version = "0.0.7" features = ["v3_10"] diff --git a/Makefile b/Makefile index 38cad81..4ccb906 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,2 @@ test: - cargo test + RUST_BACKTRACE=1 cargo test diff --git a/build.rs b/build.rs index afc333b..699c1ca 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,5 @@ - fn main() { - if cfg!(target = "windows") { + if cfg!(target_os = "windows") { println!("cargo:rustc-link-search=native=C:\\msys64\\mingw64\\lib"); } } diff --git a/src/main.rs b/src/main.rs index 7f420c5..e65c711 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ fn main() { let ui = Ui::new(); ui.show(); - Nvim::start(ui).expect("Can't start nvim instance"); + let nvim = Nvim::start(ui).expect("Can't start nvim instance"); gtk::main(); } diff --git a/src/nvim.rs b/src/nvim.rs index 0af5d1a..1960389 100644 --- a/src/nvim.rs +++ b/src/nvim.rs @@ -13,7 +13,11 @@ pub trait RedrawEvents { impl Nvim { pub fn start(mut ui: Ui) -> Result { // let mut session = try!(Session::new_tcp("127.0.0.1:6666")); - let mut session = try!(Session::new_child()); + let mut session = if cfg!(target_os = "windows") { + Session::new_child_path("E:\\Neovim\\bin\\nvim.exe").unwrap() + } else { + Session::new_child().unwrap() + }; let mut nvim = Neovim::new(session); nvim.session.start_event_loop_cb(move |m, p| Nvim::cb(&mut ui, m, p));