Resize the window by cell dimensions

This should resize window by cell dimensions granularity instead of
using pixels.

Fixes #388.
This commit is contained in:
Kirill Chibisov authored and GitHub committed 2023-02-05 11:41:23 +03:00
1 parent 8a838710e3
commit f409f74372
3 files changed
+11

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `window.decorations_theme_variant` could now control theme on macOS and Windows
- The IME purpose is now set to `Terminal` which could help with OSK
- `window.decorations_theme_variant` is now using `Dark`, `Light`, and `None` values
- Resize increments are now set on macOS and X11 to resize by cell sizes
### Fixed
+6
View File
@@ -469,6 +469,9 @@ impl Display {
renderer.finish();
}
// Set resize increments for the newly created window.
window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
window.set_visible(true);
#[allow(clippy::single_match)]
@@ -642,6 +645,9 @@ impl Display {
let search_lines = usize::from(search_active);
new_size.reserve_lines(message_bar_lines + search_lines);
// Update resize increments.
self.window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
// Resize PTY.
pty_resize_handle.on_resize(new_size.into());
+4
View File
@@ -353,6 +353,10 @@ impl Window {
self.window.set_minimized(minimized);
}
pub fn set_resize_increments(&self, increments: PhysicalSize<f32>) {
self.window.set_resize_increments(Some(increments));
}
/// Toggle the window's fullscreen state.
pub fn toggle_fullscreen(&self) {
self.set_fullscreen(self.window.fullscreen().is_none());