minor changes and add neovide variable

macos-click-through
Keith Simmons 5 years ago
parent 34034474d5
commit 39ea340693

@ -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 { let (top, bot) = if rows > 0 {
(top as i64 + rows, bot as i64) (top as i64 + rows, bot as i64)
} else if rows < 0 { } 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);
}
}

@ -14,7 +14,8 @@ use std::process::{Command, Stdio};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::thread; use std::thread;
use neovim_lib::{Neovim, UiAttachOptions, Session}; use rmpv::Value;
use neovim_lib::{Neovim, NeovimApi, UiAttachOptions, Session};
use window::ui_loop; use window::ui_loop;
use editor::Editor; use editor::Editor;
@ -58,6 +59,8 @@ fn start_nvim(editor: Arc<Mutex<Editor>>) -> Neovim {
options.set_linegrid_external(true); options.set_linegrid_external(true);
options.set_rgb(true); options.set_rgb(true);
nvim.set_var("neovide", Value::Boolean(true));
nvim.ui_attach(INITIAL_WIDTH as i64, INITIAL_HEIGHT as i64, &options) 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"); .unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process");

Loading…
Cancel
Save