handle resize more robustly

macos-click-through
Keith Simmons 5 years ago
parent 8467ef18ab
commit c1fb24c37b

@ -31,7 +31,7 @@ impl Editor {
pub fn new(width: u64, height: u64) -> Editor { pub fn new(width: u64, height: u64) -> Editor {
let mut editor = Editor { let mut editor = Editor {
grid: Vec::new(), grid: Vec::new(),
title: "".to_string(), title: "Neovide".to_string(),
cursor: Cursor::new(), cursor: Cursor::new(),
size: (width, height), size: (width, height),
default_colors: Colors::new(Some(colors::WHITE), Some(colors::BLACK), Some(colors::GREY)), default_colors: Colors::new(Some(colors::WHITE), Some(colors::BLACK), Some(colors::GREY)),

@ -52,7 +52,7 @@ pub fn ui_loop(editor: Arc<Mutex<Editor>>, nvim: Neovim, initial_size: (u64, u64
let new_width = ((new_size.width + 1.0) as f32 / renderer.font_width) as u64; let new_width = ((new_size.width + 1.0) as f32 / renderer.font_width) as u64;
let new_height = ((new_size.height + 1.0) as f32 / renderer.font_height) as u64; let new_height = ((new_size.height + 1.0) as f32 / renderer.font_height) as u64;
// Add 1 here to make sure resizing doesn't change the grid size on startup // Add 1 here to make sure resizing doesn't change the grid size on startup
nvim.ui_try_resize(new_width as i64, new_height as i64).expect("Resize failed"); nvim.ui_try_resize((new_width as i64).max(10), (new_height as i64).max(3)).expect("Resize failed");
} }
}, },

Loading…
Cancel
Save