diff --git a/src/bridge/events.rs b/src/bridge/events.rs index 44e5eb7..c73271a 100644 --- a/src/bridge/events.rs +++ b/src/bridge/events.rs @@ -270,15 +270,15 @@ pub enum RedrawEvent { #[derive(Debug)] pub enum ChannelStreamType { - STDIO, - STDERR, + Stdio, + Stderr, Socket, Job, } impl Default for ChannelStreamType { fn default() -> Self { - Self::STDIO + Self::Stdio } } @@ -286,7 +286,7 @@ impl Default for ChannelStreamType { pub enum ChannelMode { Bytes, Terminal, - RPC, + Rpc, } impl Default for ChannelMode { @@ -307,7 +307,7 @@ pub struct ClientVersion { #[derive(Debug)] pub enum ClientType { Remote, - UI, + Ui, Embedder, Host, Plugin, @@ -953,8 +953,8 @@ pub fn parse_redraw_event(event_value: Value) -> Result> { pub fn parse_channel_stream_type(channel_stream_value: Value) -> Result { match parse_string(channel_stream_value)?.as_ref() { - "stdio" => Ok(ChannelStreamType::STDIO), - "stderr" => Ok(ChannelStreamType::STDERR), + "stdio" => Ok(ChannelStreamType::Stdio), + "stderr" => Ok(ChannelStreamType::Stderr), "socket" => Ok(ChannelStreamType::Socket), "job" => Ok(ChannelStreamType::Job), _ => Err(ParseError::InvalidFormat), @@ -965,7 +965,7 @@ pub fn parse_channel_mode(channel_mode_value: Value) -> Result { match parse_string(channel_mode_value)?.as_ref() { "bytes" => Ok(ChannelMode::Bytes), "terminal" => Ok(ChannelMode::Terminal), - "rpc" => Ok(ChannelMode::RPC), + "rpc" => Ok(ChannelMode::Rpc), _ => Err(ParseError::InvalidFormat), } } @@ -996,7 +996,7 @@ pub fn parse_client_version(version_value: Value) -> Result { pub fn parse_client_type(client_type_value: Value) -> Result { match parse_string(client_type_value)?.as_ref() { "remote" => Ok(ClientType::Remote), - "ui" => Ok(ClientType::UI), + "ui" => Ok(ClientType::Ui), "embedder" => Ok(ClientType::Embedder), "host" => Ok(ClientType::Host), "plugin" => Ok(ClientType::Plugin), diff --git a/src/bridge/handler.rs b/src/bridge/handler.rs index 986bea2..a513947 100644 --- a/src/bridge/handler.rs +++ b/src/bridge/handler.rs @@ -44,7 +44,9 @@ impl Handler for NeovimHandler { ) { trace!("Neovim notification: {:?}", &event_name); + #[cfg(windows)] let ui_command_sender = self.ui_command_sender.clone(); + let redraw_event_sender = self.redraw_event_sender.clone(); task::spawn_blocking(move || match event_name.as_ref() { "redraw" => { diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index efe88d1..daf1010 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -91,6 +91,7 @@ fn build_nvim_cmd() -> Command { } } +#[cfg(windows)] pub fn build_neovide_command(channel: u64, num_args: u64, command: &str, event: &str) -> String { let nargs: String = if num_args > 1 { "+".to_string() diff --git a/src/bridge/ui_commands.rs b/src/bridge/ui_commands.rs index 82e02ab..febea43 100644 --- a/src/bridge/ui_commands.rs +++ b/src/bridge/ui_commands.rs @@ -1,4 +1,8 @@ -use log::{error, trace}; +use log::trace; + +#[cfg(windows)] +use log::Error; + use nvim_rs::compat::tokio::Compat; use nvim_rs::Neovim; use tokio::process::ChildStdin; diff --git a/src/error_handling.rs b/src/error_handling.rs index 1c97647..d0488a1 100644 --- a/src/error_handling.rs +++ b/src/error_handling.rs @@ -2,7 +2,7 @@ use log::error; fn show_error(explanation: &str) -> ! { error!("{}", explanation); - panic!(explanation.to_string()); + panic!("{}", explanation.to_string()); } pub trait ResultPanicExplanation { diff --git a/src/renderer/fonts/font_loader.rs b/src/renderer/fonts/font_loader.rs index 1853d15..aeb253c 100644 --- a/src/renderer/fonts/font_loader.rs +++ b/src/renderer/fonts/font_loader.rs @@ -237,7 +237,7 @@ mod test { assert!(font_family.is_none()); #[cfg(target_os = "linux")] - const SYSTEM_DEFAULT_FONT: &str = "DejaVu Serif"; + const SYSTEM_DEFAULT_FONT: &str = "monospace"; let font_family = loader.load(SYSTEM_DEFAULT_FONT); let result = font_family.unwrap().fonts.first().unwrap().font.full_name(); diff --git a/src/window/keyboard/token.rs b/src/window/keyboard/token.rs index aac0698..5b7d75a 100644 --- a/src/window/keyboard/token.rs +++ b/src/window/keyboard/token.rs @@ -42,7 +42,7 @@ impl<'a> Token<'a> { #[cfg(not(target_os = "windows"))] fn use_logo(logo: bool) -> bool { - return logo; + logo } // The Windows key is used for OS-level shortcuts, diff --git a/src/windows_utils.rs b/src/windows_utils.rs index 52d8a69..442b57d 100644 --- a/src/windows_utils.rs +++ b/src/windows_utils.rs @@ -1,5 +1,9 @@ -use std::ffi::CString; -use std::ptr::{null, null_mut}; +#[cfg(target_os = "windows")] +use { + std::ffi::CString, + std::ptr::{null, null_mut}, +}; + #[cfg(windows)] use winapi::{ shared::minwindef::{DWORD, HKEY, MAX_PATH},