1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

add config option to enable resize increments, disable by default

refs: #1254
refs: #1289
This commit is contained in:
Wez Furlong 2021-11-09 08:30:29 -07:00
parent 1ec7e10c19
commit 4225610c09
5 changed files with 33 additions and 7 deletions

View File

@ -1202,6 +1202,9 @@ pub struct Config {
#[serde(default = "default_true")]
pub adjust_window_size_when_changing_font_size: bool,
#[serde(default)]
pub use_resize_increments: bool,
#[serde(default = "default_alternate_buffer_wheel_scroll_speed")]
pub alternate_buffer_wheel_scroll_speed: u8,

View File

@ -17,7 +17,7 @@ As features stabilize some brief notes about them will accumulate here.
* it is now possible to define colors in the range 16-255 in `colors` and color scheme definitions. Thanks to [@potamides](https://github.com/potamides)! [#841](https://github.com/wez/wezterm/issues/841) [#1056](https://github.com/wez/wezterm/pull/1056)
* Added [SendKey](config/lua/keyassignment/SendKey.md) key assignment action that makes it more convenient to rebind the key input that is sent to a pane.
* Added [Multiple](config/lua/keyassignment/Multiple.md) key assignment action for combining multuple actions in a single press.
* X11, Wayland, macOS: Window resizing now prefers to step in increments of the cell size
* Added [use_resize_increments](config/lua/config/use_resize_increments.md) option to tell X11, Wayland, macOS window resizing to prefers to step in increments of the cell size
* [visual_bell](config/lua/config/visual_bell.md) and [audible_bell](config/lua/config/audible_bell.md) configuration options, as well as a [bell](config/lua/window-events/bell.md) event allows you to trigger lua code when the bell is run. [#3](https://github.com/wez/wezterm/issues/3)
* [wezterm.action_callback](config/lua/wezterm/action_callback.md) function to make it easier to use custom events. Thanks to [@bew](https://github.com/bew)! [#1151](https://github.com/wez/wezterm/pull/1151)
* `wezterm connect` now also supports the `--class` parameter to override the window class

View File

@ -0,0 +1,13 @@
# use_resize_increments = false
*Since: nightly builds only*
When set to `true`, prefer to snap the window size to a multiple of the
terminal cell size. The default is `false`, which allows sizing the window to
an arbitrary size.
This option is only respected on X11, Wayland and macOS systems.
Note that if you have configured [window_padding](window_padding.md) then the
resize increments don't take the padding into account.

View File

@ -675,10 +675,12 @@ impl TermWindow {
let mut myself = tw.borrow_mut();
myself.config_subscription.replace(config_subscription);
myself.gl.replace(Rc::clone(&gl));
window.set_resize_increments(
myself.render_metrics.cell_size.width as u16,
myself.render_metrics.cell_size.height as u16,
);
if config.use_resize_increments {
window.set_resize_increments(
myself.render_metrics.cell_size.width as u16,
myself.render_metrics.cell_size.height as u16,
);
}
myself.created(&window, Rc::clone(&gl))?;
myself.subscribe_to_pane_updates();

View File

@ -76,8 +76,16 @@ impl super::TermWindow {
}
window.set_resize_increments(
self.render_metrics.cell_size.width as u16,
self.render_metrics.cell_size.height as u16,
if self.config.use_resize_increments {
self.render_metrics.cell_size.width as u16
} else {
1
},
if self.config.use_resize_increments {
self.render_metrics.cell_size.height as u16
} else {
1
},
);
if let Err(err) = self.recreate_texture_atlas(None) {