diff --git a/src/cmd_line.rs b/src/cmd_line.rs index 70b7d2e..38a99f2 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -1,4 +1,5 @@ use crate::settings::*; +use crate::utils::Dimensions; use clap::{App, Arg}; @@ -11,7 +12,7 @@ pub struct CmdLineSettings { pub files_to_open: Vec, pub nofork: bool, - pub geometry: WindowGeometry, + pub geometry: Dimensions, pub wsl: bool, pub remote_tcp: Option, pub multi_grid: bool, diff --git a/src/main.rs b/src/main.rs index 0de485d..a2bbd8c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ mod error_handling; mod redraw_scheduler; mod renderer; mod settings; +mod utils; mod window; pub mod windows_utils; diff --git a/src/renderer/cursor_renderer/mod.rs b/src/renderer/cursor_renderer/mod.rs index 05d1ae5..6514244 100644 --- a/src/renderer/cursor_renderer/mod.rs +++ b/src/renderer/cursor_renderer/mod.rs @@ -228,8 +228,7 @@ impl CursorRenderer { pub fn update_cursor_destination( &mut self, - font_width: u64, - font_height: u64, + (font_width, font_height): (u64, u64), windows: &HashMap, ) { let (cursor_grid_x, cursor_grid_y) = self.cursor.grid_position; @@ -244,7 +243,7 @@ impl CursorRenderer { // grid position. grid_y = grid_y .max(window.grid_current_position.y) - .min(window.grid_current_position.y + window.grid_height as f32 - 1.0); + .min(window.grid_current_position.y + window.grid_size.height as f32 - 1.0); self.destination = (grid_x * font_width as f32, grid_y * font_height as f32).into(); } else { @@ -259,13 +258,12 @@ impl CursorRenderer { pub fn draw( &mut self, default_colors: &Colors, - font_size: (u64, u64), + (font_width, font_height): (u64, u64), current_mode: &EditorMode, shaper: &mut CachingShaper, canvas: &mut Canvas, dt: f32, ) { - let (font_width, font_height) = font_size; let render = self.blink_status.update_status(&self.cursor); let settings = SETTINGS.get::(); diff --git a/src/renderer/fonts/caching_shaper.rs b/src/renderer/fonts/caching_shaper.rs index 331967c..0da30eb 100644 --- a/src/renderer/fonts/caching_shaper.rs +++ b/src/renderer/fonts/caching_shaper.rs @@ -231,7 +231,7 @@ impl CachingShaper { pub fn shape(&mut self, cells: &[String], bold: bool, italic: bool) -> Vec { let current_size = self.current_size(); - let (glyph_width, _glyph_height) = self.font_base_dimensions(); + let (glyph_width, ..) = self.font_base_dimensions(); let mut resulting_blobs = Vec::new(); diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index e2d56b9..a5afc22 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -1,3 +1,8 @@ +pub mod animation_utils; +pub mod cursor_renderer; +mod fonts; +mod rendered_window; + use std::collections::HashMap; use std::sync::mpsc::Receiver; use std::sync::Arc; @@ -6,18 +11,13 @@ use glutin::dpi::PhysicalSize; use log::{error, trace}; use skia_safe::{colors, dash_path_effect, BlendMode, Canvas, Color, Paint, Rect, HSV}; -pub mod animation_utils; -pub mod cursor_renderer; -mod fonts; -mod rendered_window; - -pub use fonts::caching_shaper::CachingShaper; -pub use rendered_window::{RenderedWindow, WindowDrawDetails}; - use crate::bridge::EditorMode; use crate::editor::{Colors, DrawCommand, Style, WindowDrawCommand}; use crate::settings::*; +use crate::utils::Dimensions; use cursor_renderer::CursorRenderer; +pub use fonts::caching_shaper::CachingShaper; +pub use rendered_window::{RenderedWindow, WindowDrawDetails}; #[derive(SettingGroup)] #[setting_prefix = "window"] @@ -48,8 +48,7 @@ pub struct Renderer { pub paint: Paint, pub shaper: CachingShaper, pub default_style: Arc