Merge branch 'main' into main

macos-click-through
multisn8 3 years ago committed by GitHub
commit 9a40efbf1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,7 +29,7 @@ If applicable, add screenshots to help explain your problem.
- Neovide Version [e.g. 0.6.0] - Neovide Version [e.g. 0.6.0]
- Neovim Version [e.g. 0.5.0] - Neovim Version [e.g. 0.5.0]
**Please run `neovide --log` and paste the contents of the `.log` file here:** **Please run `neovide --log` and paste the contents of the `.log` file created in the current directory here:**
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.

812
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
[package] [package]
name = "neovide" name = "neovide"
version = "0.8.0" version = "0.9.0"
authors = ["keith <keith@the-simmons.net>"] authors = ["keith <keith@the-simmons.net>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@ -16,53 +16,53 @@ default = []
embed-fonts = [] embed-fonts = []
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } async-trait = "0.1.53"
serde_json = "1.0" cfg-if = "1.0.0"
clap = { version = "3.1.9", features = ["cargo"] }
clipboard = "0.5.0"
derive-new = "0.5.9"
dirs = "4.0.0"
euclid = "0.22.7"
flexi_logger = { version = "0.22.3", default-features = false }
futures = "0.3.21"
gl = "0.14.0"
glutin = { git = "https://github.com/neovide/glutin", branch = "new-keyboard-all", features = ["serde"] }
image = { version = "0.24.1", default-features = false, features = ["ico"] }
lazy_static = "1.4.0"
log = "0.4.16"
lru = "0.7.5"
neovide-derive = { path = "neovide-derive" } neovide-derive = { path = "neovide-derive" }
euclid = "0.20.7"
lru = "0.4.3"
derive-new = "0.5"
rmpv = "1.0.0"
image = { version = "0.22.3", default-features = false, features = ["ico"] }
nvim-rs = { git = "https://github.com/KillTheMule/nvim-rs", branch = "master", features = ["use_tokio"] } nvim-rs = { git = "https://github.com/KillTheMule/nvim-rs", branch = "master", features = ["use_tokio"] }
tokio = { version = "1.1.1", features = ["full"] } parking_lot = "0.12.0"
tokio-util = "0.6.7" pin-project = "1.0.10"
async-trait = "0.1.18" rand = "0.8.5"
lazy_static = "1.4.0" rmpv = "1.0.0"
unicode-segmentation = "1.6.0" serde = { version = "1.0.136", features = ["derive"] }
log = "0.4.8" serde_json = "1.0.79"
flexi_logger = { version = "0.17.1", default-features = false }
parking_lot = "0.10.0"
cfg-if = "0.1.10"
which = "4"
dirs = "2"
rand = "0.7"
pin-project = "0.4.27"
futures = "0.3.12"
glutin = { git = "https://github.com/neovide/glutin", branch = "new-keyboard-all", features=["serde"] }
winit = { git = "https://github.com/neovide/winit", branch = "new-keyboard-all" }
gl = "0.14.0"
swash = "0.1.4" swash = "0.1.4"
clap="2.33.3" tokio = { version = "1.17.0", features = ["full"] }
xdg="2.4.0" tokio-util = { version = "0.7.1", features = ["compat"] }
clipboard="0.5.0" unicode-segmentation = "1.9.0"
which = "4.2.5"
winit = { git = "https://github.com/neovide/winit", branch = "new-keyboard-all" }
xdg = "2.4.1"
[dev-dependencies] [dev-dependencies]
mockall = "0.7.0" mockall = "0.11.0"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["winuser"] } winapi = { version = "0.3.9", features = ["winuser"] }
[target.'cfg(windows)'.build-dependencies] [target.'cfg(windows)'.build-dependencies]
winres = "0.1.11" winres = "0.1.12"
[target.'cfg(linux)'.dependencies.skia-safe] [target.'cfg(linux)'.dependencies.skia-safe]
features = ["gl", "egl"] features = ["gl", "egl"]
version = "^0.42.1" version = "0.49.1"
[target.'cfg(not(linux))'.dependencies.skia-safe] [target.'cfg(not(linux))'.dependencies.skia-safe]
features = ["gl"] features = ["gl"]
version = "^0.42.1" version = "0.49.1"
[profile.release] [profile.release]
debug = true debug = true
@ -73,7 +73,7 @@ incremental = true
name = "Neovide" name = "Neovide"
identifier = "com.neovide.neovide" identifier = "com.neovide.neovide"
icon = ["assets/neovide.ico"] icon = ["assets/neovide.ico"]
version = "0.8.0" version = "0.9.0"
resources = [] resources = []
copyright = "Copyright (c) Keith 2021. All rights reserved." copyright = "Copyright (c) Keith 2021. All rights reserved."
category = "Productivity" category = "Productivity"

@ -116,7 +116,7 @@ Configuration is done almost completely via global neovide variables in your vim
**Note**: Building instructions are somewhat limited at the moment. All the libraries I use are cross platform and should have **Note**: Building instructions are somewhat limited at the moment. All the libraries I use are cross platform and should have
support for Windows, Mac, and Linux. On Windows this should be enabled by default if you have a relatively recent system. support for Windows, Mac, and Linux. On Windows this should be enabled by default if you have a relatively recent system.
**Note**: Neovide requires neovim version 0.6 or greater if built from main, or 0.4 if downloaded from releases. **Note**: Neovide requires neovim version 0.6 or greater. See previous releases such as `0.5.0` if your distro is too slow with updating.
### From binary ### From binary

@ -1,6 +1,6 @@
name: neovide # you probably want to 'snapcraft register <name>' name: neovide # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap base: core20 # the base snap is the execution environment for this snap
version: "0.8.0+git" version: "0.9.0+git"
summary: The snappiest vim editor you are likely to find. summary: The snappiest vim editor you are likely to find.
description: | description: |
This is a simple graphical user interface for Neovim. Where possible there are some graphical improvements, This is a simple graphical user interface for Neovim. Where possible there are some graphical improvements,

@ -1,6 +1,6 @@
use crate::{dimensions::Dimensions, frame::Frame, settings::*}; use crate::{dimensions::Dimensions, frame::Frame, settings::*};
use clap::{App, Arg}; use clap::{Arg, Command};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct CmdLineSettings { pub struct CmdLineSettings {
@ -54,99 +54,99 @@ impl Default for CmdLineSettings {
} }
pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> { pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
let clapp = App::new("Neovide") let clapp = Command::new("Neovide")
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
// Pass through arguments // Pass through arguments
.arg( .arg(
Arg::with_name("files_to_open") Arg::new("files_to_open")
.multiple(true) .multiple_values(true)
.takes_value(true) .takes_value(true)
.help("Files to open"), .help("Files to open"),
) )
.arg( .arg(
Arg::with_name("neovim_args") Arg::new("neovim_args")
.multiple(true) .multiple_values(true)
.takes_value(true) .takes_value(true)
.last(true) .last(true)
.help("Specify Arguments to pass down to neovim"), .help("Specify Arguments to pass down to neovim"),
) )
// Command-line arguments only // Command-line arguments only
.arg( .arg(
Arg::with_name("geometry") Arg::new("geometry")
.long("geometry") .long("geometry")
.takes_value(true) .takes_value(true)
.help("Specify the Geometry of the window"), .help("Specify the Geometry of the window"),
) )
.arg( .arg(
Arg::with_name("log_to_file") Arg::new("log_to_file")
.long("log") .long("log")
.help("Log to a file"), .help("Log to a file"),
) )
.arg( .arg(
Arg::with_name("nofork") Arg::new("nofork")
.long("nofork") .long("nofork")
.help("Do not detach process from terminal"), .help("Do not detach process from terminal"),
) )
.arg( .arg(
Arg::with_name("no_tabs") Arg::new("no_tabs")
.long("notabs") .long("notabs")
.help("Disable open multiple files as tabs"), .help("Disable open multiple files as tabs"),
) )
.arg( .arg(
Arg::with_name("remote_tcp") Arg::new("remote_tcp")
.long("remote-tcp") .long("remote-tcp")
.takes_value(true) .takes_value(true)
.help("Connect to Remote TCP"), .help("Connect to Remote TCP"),
) )
.arg( .arg(
Arg::with_name("wsl") Arg::new("wsl")
.long("wsl") .long("wsl")
.help("Run in WSL") .help("Run in WSL")
) )
// Command-line flags with environment variable fallback // Command-line flags with environment variable fallback
.arg( .arg(
Arg::with_name("frame") Arg::new("frame")
.long("frame") .long("frame")
.takes_value(true) .takes_value(true)
.help("Configure the window frame. NOTE: Window might not be resizable if setting is None.") .help("Configure the window frame. NOTE: Window might not be resizable if setting is None.")
) )
.arg( .arg(
Arg::with_name("maximized") Arg::new("maximized")
.long("maximized") .long("maximized")
.help("Maximize the window"), .help("Maximize the window"),
) )
.arg( .arg(
Arg::with_name("multi_grid") Arg::new("multi_grid")
.long("multigrid") .long("multigrid")
.help("Enable Multigrid"), .help("Enable Multigrid"),
) )
.arg( .arg(
Arg::with_name("noidle") Arg::new("noidle")
.long("noidle") .long("noidle")
.help("Render every frame. Takes more power and cpu time but possibly fixes animation issues"), .help("Render every frame. Takes more power and cpu time but possibly fixes animation issues"),
) )
.arg( .arg(
Arg::with_name("nosrgb") Arg::new("nosrgb")
.long("nosrgb") .long("nosrgb")
.help("Do not use standard color space to initialize the window. Swapping this variable sometimes fixes issues on startup"), .help("Do not use standard color space to initialize the window. Swapping this variable sometimes fixes issues on startup"),
) )
// Command-line arguments with environment variable fallback // Command-line arguments with environment variable fallback
.arg( .arg(
Arg::with_name("neovim_bin") Arg::new("neovim_bin")
.long("neovim-bin") .long("neovim-bin")
.takes_value(true) .takes_value(true)
.help("Specify path to neovim"), .help("Specify path to neovim"),
) )
.arg( .arg(
Arg::with_name("wayland_app_id") Arg::new("wayland_app_id")
.long("wayland-app-id") .long("wayland-app-id")
.takes_value(true) .takes_value(true)
.help("Specify an App ID for Wayland"), .help("Specify an App ID for Wayland"),
) )
.arg( .arg(
Arg::with_name("x11_wm_class") Arg::new("x11_wm_class")
.long("x11-wm-class") .long("x11-wm-class")
.takes_value(true) .takes_value(true)
.help("Specify an X11 WM class"), .help("Specify an X11 WM class"),
@ -329,7 +329,7 @@ mod tests {
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
handle_command_line_arguments(args).expect("Could not parse arguments"); handle_command_line_arguments(args).expect("Could not parse arguments");
assert_eq!(SETTINGS.get::<CmdLineSettings>().log_to_file, true); assert!(SETTINGS.get::<CmdLineSettings>().log_to_file);
} }
#[test] #[test]

@ -84,7 +84,7 @@ impl Cursor {
return self return self
.style .style
.as_ref() .as_ref()
.map(|s| (255 as f32 * ((100 - s.blend) as f32 / (100.0 as f32))) as u8) .map(|s| (255_f32 * ((100 - s.blend) as f32 / 100.0_f32)) as u8)
.unwrap_or(255); .unwrap_or(255);
} }
@ -160,7 +160,7 @@ mod tests {
cursor.foreground(&DEFAULT_COLORS), cursor.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.background.unwrap() DEFAULT_COLORS.background.unwrap()
); );
cursor.style = style.clone(); cursor.style = style;
assert_eq!( assert_eq!(
cursor.foreground(&DEFAULT_COLORS), cursor.foreground(&DEFAULT_COLORS),
COLORS.foreground.unwrap() COLORS.foreground.unwrap()
@ -182,7 +182,7 @@ mod tests {
cursor.background(&DEFAULT_COLORS), cursor.background(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.unwrap() DEFAULT_COLORS.foreground.unwrap()
); );
cursor.style = style.clone(); cursor.style = style;
assert_eq!( assert_eq!(
cursor.background(&DEFAULT_COLORS), cursor.background(&DEFAULT_COLORS),
COLORS.background.unwrap() COLORS.background.unwrap()

@ -199,10 +199,7 @@ mod tests {
// RUN FUNCTION // RUN FUNCTION
character_grid.set_all_characters(grid_cell.clone()); character_grid.set_all_characters(grid_cell.clone());
assert_eq!( assert_eq!(character_grid.characters, vec![grid_cell; context.area]);
character_grid.characters,
vec![grid_cell.clone(); context.area]
);
} }
#[test] #[test]
@ -214,7 +211,7 @@ mod tests {
"foo".to_string(), "foo".to_string(),
Some(Arc::new(Style::new(context.none_colors))), Some(Arc::new(Style::new(context.none_colors))),
); );
character_grid.characters = vec![grid_cell.clone(); context.area]; character_grid.characters = vec![grid_cell; context.area];
// RUN FUNCTION // RUN FUNCTION
character_grid.clear(); character_grid.clear();

@ -83,7 +83,7 @@ impl Editor {
} }
RedrawEvent::ModeInfoSet { cursor_modes } => { RedrawEvent::ModeInfoSet { cursor_modes } => {
self.mode_list = cursor_modes; self.mode_list = cursor_modes;
if let Some(current_mode_i) = self.current_mode_index.clone() { if let Some(current_mode_i) = self.current_mode_index {
if let Some(current_mode) = self.mode_list.get(current_mode_i as usize) { if let Some(current_mode) = self.mode_list.get(current_mode_i as usize) {
self.cursor.change_mode(current_mode, &self.defined_styles) self.cursor.change_mode(current_mode, &self.defined_styles)
} }

@ -367,6 +367,6 @@ mod tests {
let sent_commands = draw_command_receiver let sent_commands = draw_command_receiver
.try_recv() .try_recv()
.expect("Could not receive commands"); .expect("Could not receive commands");
assert!(sent_commands.len() != 0); assert!(!sent_commands.is_empty());
} }
} }

@ -1,8 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// Test naming occasionally uses camelCase with underscores to separate sections of // Test naming occasionally uses camelCase with underscores to separate sections of
// the test name. // the test name.
#[cfg_attr(test, allow(non_snake_case))] #![cfg_attr(test, allow(non_snake_case))]
#[macro_use] #[macro_use]
extern crate neovide_derive; extern crate neovide_derive;
@ -34,7 +33,7 @@ extern crate lazy_static;
use std::env::args; use std::env::args;
#[cfg(not(test))] #[cfg(not(test))]
use flexi_logger::{Cleanup, Criterion, Duplicate, Logger, Naming}; use flexi_logger::{Cleanup, Criterion, Duplicate, FileSpec, Logger, Naming};
use log::trace; use log::trace;
use bridge::start_bridge; use bridge::start_bridge;
@ -150,8 +149,9 @@ pub fn init_logger() {
let settings = SETTINGS.get::<CmdLineSettings>(); let settings = SETTINGS.get::<CmdLineSettings>();
let logger = if settings.log_to_file { let logger = if settings.log_to_file {
Logger::with_env_or_str("neovide") Logger::try_with_env_or_str("neovide")
.log_to_file() .expect("Could not init logger")
.log_to_file(FileSpec::default())
.rotate( .rotate(
Criterion::Size(10_000_000), Criterion::Size(10_000_000),
Naming::Timestamps, Naming::Timestamps,
@ -159,7 +159,7 @@ pub fn init_logger() {
) )
.duplicate_to_stderr(Duplicate::Error) .duplicate_to_stderr(Duplicate::Error)
} else { } else {
Logger::with_env_or_str("neovide = error") Logger::try_with_env_or_str("neovide = error").expect("Cloud not init logger")
}; };
logger.start().expect("Could not start logger"); logger.start().expect("Could not start logger");

@ -204,12 +204,12 @@ impl CursorRenderer {
} }
pub fn handle_event(&mut self, event: &Event<()>) { pub fn handle_event(&mut self, event: &Event<()>) {
match event { if let Event::WindowEvent {
Event::WindowEvent { event: WindowEvent::Focused(is_focused),
event: WindowEvent::Focused(is_focused), ..
.. } = event
} => self.window_has_focus = *is_focused, {
_ => {} self.window_has_focus = *is_focused
} }
} }
@ -424,7 +424,7 @@ impl CursorRenderer {
path.line_to(self.corners[3].current_position); path.line_to(self.corners[3].current_position);
path.close(); path.close();
canvas.draw_path(&path, &paint); canvas.draw_path(&path, paint);
path path
} }
@ -459,7 +459,7 @@ impl CursorRenderer {
// from the larger one. This can fail in which case we return a full "rectangle". // from the larger one. This can fail in which case we return a full "rectangle".
let path = op(&rectangle, &subtract, skia_safe::PathOp::Difference).unwrap_or(rectangle); let path = op(&rectangle, &subtract, skia_safe::PathOp::Difference).unwrap_or(rectangle);
canvas.draw_path(&path, &paint); canvas.draw_path(&path, paint);
path path
} }
} }

@ -69,9 +69,6 @@ impl Settings {
pub fn set<T: Clone + Send + Sync + 'static>(&self, t: &T) { pub fn set<T: Clone + Send + Sync + 'static>(&self, t: &T) {
let type_id: TypeId = TypeId::of::<T>(); let type_id: TypeId = TypeId::of::<T>();
let t: T = (*t).clone(); let t: T = (*t).clone();
unsafe {
self.settings.force_unlock_write();
}
let mut write_lock = self.settings.write(); let mut write_lock = self.settings.write();
write_lock.insert(type_id, Box::new(t)); write_lock.insert(type_id, Box::new(t));
} }
@ -143,7 +140,6 @@ impl Settings {
mod tests { mod tests {
use async_trait::async_trait; use async_trait::async_trait;
use nvim_rs::{Handler, Neovim}; use nvim_rs::{Handler, Neovim};
use tokio;
use super::*; use super::*;
use crate::{ use crate::{
@ -224,8 +220,8 @@ mod tests {
let vt2 = TypeId::of::<f32>(); let vt2 = TypeId::of::<f32>();
let mut values = settings.settings.write(); let mut values = settings.settings.write();
values.insert(vt1, Box::new(v1.clone())); values.insert(vt1, Box::new(v1));
values.insert(vt2, Box::new(v2.clone())); values.insert(vt2, Box::new(v2));
unsafe { unsafe {
settings.settings.force_unlock_write(); settings.settings.force_unlock_write();

@ -199,10 +199,26 @@ impl GlutinWindowWrapper {
} }
let new_size = window.inner_size(); let new_size = window.inner_size();
// The size needs to be scaled, otherwise any flag or setting related
// to the geometry or window size will be ignored because of the boolean
// value of `resized_at_startup`
let scale_factor = window.scale_factor() as u32;
let new_size_scaled = PhysicalSize {
width: new_size.width / scale_factor,
height: new_size.height / scale_factor,
};
let settings = SETTINGS.get::<CmdLineSettings>(); let settings = SETTINGS.get::<CmdLineSettings>();
// Resize at startup happens when window is maximized or when using tiling WM // Resize at startup happens when window is maximized or when using tiling WM
// which already resized window. // which already resized window.
let resized_at_startup = settings.maximized || is_already_resized(new_size); let resized_at_startup = settings.maximized || is_already_resized(new_size_scaled);
log::trace!(
"Settings geometry {:?}",
PhysicalSize::from(settings.geometry)
);
log::trace!("Inner size: {:?}", new_size);
log::trace!("Inner size scaled: {:?}", new_size_scaled);
if self.saved_grid_size.is_none() && !resized_at_startup { if self.saved_grid_size.is_none() && !resized_at_startup {
window.set_inner_size( window.set_inner_size(
@ -418,5 +434,6 @@ pub fn create_window() {
} }
fn is_already_resized(size: PhysicalSize<u32>) -> bool { fn is_already_resized(size: PhysicalSize<u32>) -> bool {
// TODO: Use a constant instead.
size != PhysicalSize::from((800, 600)) size != PhysicalSize::from((800, 600))
} }

Loading…
Cancel
Save