temp fix for scrolling problem

macos-click-through
Keith Simmons 5 years ago
parent af403e536f
commit 850cf3c6db

2366
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -15,7 +15,7 @@ derive-new = "0.5"
rmpv = "0.4.4" rmpv = "0.4.4"
rust-embed = { version = "5.2.0", features = ["debug-embed"] } rust-embed = { version = "5.2.0", features = ["debug-embed"] }
image = "0.22.3" image = "0.22.3"
nvim-rs = { git = "https://github.com/KillTheMule/nvim-rs", features = [ "use_tokio" ] } nvim-rs = { git = "https://github.com/kethku/nvim-rs", features = [ "use_tokio" ] }
tokio = { version = "0.2.9", features = [ "blocking", "process", "time" ] } tokio = { version = "0.2.9", features = [ "blocking", "process", "time" ] }
async-trait = "0.1.18" async-trait = "0.1.18"
lazy_static = "1.4.0" lazy_static = "1.4.0"

@ -10,33 +10,7 @@ use crate::editor::EDITOR;
use super::events::{RedrawEvent, parse_neovim_event}; use super::events::{RedrawEvent, parse_neovim_event};
#[derive(Clone)] #[derive(Clone)]
pub struct NeovimHandler { pub struct NeovimHandler();
sender: UnboundedSender<RedrawEvent>
}
impl NeovimHandler {
pub fn new() -> NeovimHandler {
let (sender, mut receiver) = unbounded_channel::<RedrawEvent>();
tokio::spawn(async move {
while let Some(event) = receiver.recv().await {
let mut editor = EDITOR.lock();
editor.handle_redraw_event(event);
}
});
NeovimHandler {
sender
}
}
pub fn handle_redraw_event(&self, event: RedrawEvent) {
self.sender.send(event)
.unwrap_or_explained_panic(
"The main thread for Neovide has closed the communication channel preventing a neovim event from being processed.");
}
}
#[async_trait] #[async_trait]
impl Handler for NeovimHandler { impl Handler for NeovimHandler {
@ -47,7 +21,8 @@ impl Handler for NeovimHandler {
let parsed_events = parse_neovim_event(&event_name, arguments) let parsed_events = parse_neovim_event(&event_name, arguments)
.unwrap_or_explained_panic("Could not parse event from neovim"); .unwrap_or_explained_panic("Could not parse event from neovim");
for event in parsed_events { for event in parsed_events {
self.handle_redraw_event(event); let mut editor = EDITOR.lock();
editor.handle_redraw_event(event);
} }
} }
} }

@ -8,7 +8,7 @@ use std::process::Stdio;
use rmpv::Value; use rmpv::Value;
use nvim_rs::{create::tokio as create, UiAttachOptions}; use nvim_rs::{create::tokio as create, UiAttachOptions};
use tokio::runtime::Runtime; use tokio::runtime::{Runtime};
use tokio::process::Command; use tokio::process::Command;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use log::{info, error, trace}; use log::{info, error, trace};
@ -60,7 +60,7 @@ async fn drain(receiver: &mut UnboundedReceiver<UiCommand>) -> Option<Vec<UiComm
async fn start_process(mut receiver: UnboundedReceiver<UiCommand>) { async fn start_process(mut receiver: UnboundedReceiver<UiCommand>) {
let (width, height) = INITIAL_DIMENSIONS; let (width, height) = INITIAL_DIMENSIONS;
let (mut nvim, io_handler, _) = create::new_child_cmd(&mut create_nvim_command(), NeovimHandler::new()).await let (mut nvim, io_handler, _) = create::new_child_cmd(&mut create_nvim_command(), NeovimHandler()).await
.unwrap_or_explained_panic("Could not locate or start the neovim process"); .unwrap_or_explained_panic("Could not locate or start the neovim process");
tokio::spawn(async move { tokio::spawn(async move {
@ -126,7 +126,7 @@ async fn start_process(mut receiver: UnboundedReceiver<UiCommand>) {
} }
pub struct Bridge { pub struct Bridge {
_runtime: Runtime, _runtime: Runtime, // Necessary to keep runtime running
sender: UnboundedSender<UiCommand> sender: UnboundedSender<UiCommand>
} }

Loading…
Cancel
Save