From 39ea340693bc0a9aa07829d256c4099feb40a469 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 9 Jan 2020 13:25:09 -0800 Subject: [PATCH] minor changes and add neovide variable --- src/editor/mod.rs | 11 ++++++++++- src/main.rs | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/editor/mod.rs b/src/editor/mod.rs index d410816..8a7ec3c 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -203,7 +203,7 @@ impl Editor { } } - fn scroll_region(&mut self, top: u64, bot: u64, left: u64, right: u64, rows: i64, cols: i64) { + pub fn scroll_region(&mut self, top: u64, bot: u64, left: u64, right: u64, rows: i64, cols: i64) { let (top, bot) = if rows > 0 { (top as i64 + rows, bot as i64) } else if rows < 0 { @@ -276,3 +276,12 @@ impl Editor { } } } + +#[cfg(test)] +mod tests { + #[test] + fn scrolling_test() { + let mut editor = Editor::new(10, 10); + } +} + diff --git a/src/main.rs b/src/main.rs index ac75684..9627237 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,8 @@ use std::process::{Command, Stdio}; use std::sync::{Arc, Mutex}; use std::thread; -use neovim_lib::{Neovim, UiAttachOptions, Session}; +use rmpv::Value; +use neovim_lib::{Neovim, NeovimApi, UiAttachOptions, Session}; use window::ui_loop; use editor::Editor; @@ -58,6 +59,8 @@ fn start_nvim(editor: Arc>) -> Neovim { options.set_linegrid_external(true); options.set_rgb(true); + nvim.set_var("neovide", Value::Boolean(true)); + nvim.ui_attach(INITIAL_WIDTH as i64, INITIAL_HEIGHT as i64, &options) .unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process");