diff options
author | ii41 <23465321+ii41@users.noreply.github.com> | 2020-09-27 15:36:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-27 22:36:08 +0000 |
commit | a754d06b44139b85e8b34a71ece4477cb1caa85e (patch) | |
tree | 1733f8d17101947b6df5e1ad15b3fd64cf1db9a0 /alacritty/src/window.rs | |
parent | e9c0034f4d3ee003149fe5454942bea7ff3d98be (diff) | |
download | r-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.tar.gz r-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.tar.bz2 r-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.zip |
Add support for single line terminals
This changes the minimum terminal dimensions from 2 lines and 2 columns,
to 1 line and 2 columns.
This also reworks the `SizeInfo` to store the number of columns and
lines and consistently has only the terminal lines/columns stored,
instead of including the message bar and search in some places of the
Alacritty renderer/input.
These new changes also make it easy to properly start the selection
scrolling as soon as the mouse is over the message bar, instead of
waiting until it is beyond it.
Fixes #4207.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/window.rs')
-rw-r--r-- | alacritty/src/window.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index 3319dce8..92fedc86 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -137,6 +137,9 @@ pub struct Window { #[cfg(not(any(target_os = "macos", windows)))] pub wayland_surface: Option<Attached<WlSurface>>, + /// Cached DPR for quickly scaling pixel sizes. + pub dpr: f64, + windowed_context: WindowedContext<PossiblyCurrent>, current_mouse_cursor: CursorIcon, mouse_visible: bool, @@ -192,6 +195,8 @@ impl Window { wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token())); } + let dpr = windowed_context.window().scale_factor(); + Ok(Self { current_mouse_cursor, mouse_visible: true, @@ -200,6 +205,7 @@ impl Window { should_draw: Arc::new(AtomicBool::new(true)), #[cfg(not(any(target_os = "macos", windows)))] wayland_surface, + dpr, }) } @@ -211,10 +217,6 @@ impl Window { self.window().inner_size() } - pub fn scale_factor(&self) -> f64 { - self.window().scale_factor() - } - #[inline] pub fn set_visible(&self, visibility: bool) { self.window().set_visible(visibility); @@ -387,11 +389,9 @@ impl Window { /// Adjust the IME editor position according to the new location of the cursor. #[cfg(not(windows))] - pub fn update_ime_position(&mut self, point: Point, size_info: &SizeInfo) { - let SizeInfo { cell_width, cell_height, padding_x, padding_y, .. } = size_info; - - let nspot_x = f64::from(padding_x + point.col.0 as f32 * cell_width); - let nspot_y = f64::from(padding_y + (point.line.0 + 1) as f32 * cell_height); + pub fn update_ime_position(&mut self, point: Point, size: &SizeInfo) { + let nspot_x = f64::from(size.padding_x() + point.col.0 as f32 * size.cell_width()); + let nspot_y = f64::from(size.padding_y() + (point.line.0 + 1) as f32 * size.cell_height()); self.window().set_ime_position(PhysicalPosition::new(nspot_x, nspot_y)); } |