wezterm: add adjust_window_size_when_changing_font_size option
The default is true, which means that adjusting the font size will cause the window to resize to preserve the number of rows/cols in the terminal. When set to false, the window size is preserved and the number of terminal rows/cols is adjusted instead. refs: https://github.com/wez/wezterm/issues/431
This commit is contained in:
1 parent
b60e83b22b
commit
89c1ac5b4c
3 files changed
+22
-3
No files matched your search
@@ -845,6 +845,9 @@ pub struct Config {
|
||||
|
||||
#[serde(default = "default_word_boundary")]
|
||||
pub selection_word_boundary: String,
|
||||
|
||||
#[serde(default = "default_true")]
|
||||
pub adjust_window_size_when_changing_font_size: bool,
|
||||
}
|
||||
|
||||
fn default_word_boundary() -> String {
|
||||
|
||||
@@ -44,6 +44,7 @@ brief notes about them may accumulate here.
|
||||
* Fixed an issue where the mouse wheel wasn't mapped to cursor up/down when the alternate screen was active [#429](https://github.com/wez/wezterm/issues/429)
|
||||
* Fixed `ToggleFullScreen` not working on macOS and X11. It still doesn't function on Windows. `native_macos_fullscreen_mode = false` uses a fast full-screen window on macOS. Set it to `true` to use the slower macOS native "Spaces" style fullscreen mode. [#177](https://github.com/wez/wezterm/issues/177)
|
||||
* Windows: fix an issue where the initial window size didn't factor the correct DPI when the system-wide display scaling was not 100%. [#427](https://github.com/wez/wezterm/issues/427)
|
||||
* New: `adjust_window_size_when_changing_font_size` option to control whether changing the font size adjusts the dimensions of the window (true) or adjusts the number of terminal rows/columns (false). The default is `true`. [#431](https://github.com/wez/wezterm/issues/431)
|
||||
|
||||
### 20201101-103216-403d002d
|
||||
|
||||
|
||||
@@ -2306,14 +2306,29 @@ impl TermWindow {
|
||||
self.apply_dimensions(&dimensions, scale_changed_cells);
|
||||
}
|
||||
|
||||
// Used for applying font size changes only; this takes into account
|
||||
// the `adjust_window_size_when_changing_font_size` configuration and
|
||||
// revises the scaling/resize change accordingly
|
||||
fn adjust_font_scale(&mut self, font_scale: f64) {
|
||||
if configuration().adjust_window_size_when_changing_font_size {
|
||||
self.scaling_changed(self.dimensions, font_scale);
|
||||
} else {
|
||||
let dimensions = self.dimensions;
|
||||
// Compute new font metrics
|
||||
self.apply_scale_change(&dimensions, font_scale);
|
||||
// Now revise the pty size to fit the window
|
||||
self.apply_dimensions(&dimensions, None);
|
||||
}
|
||||
}
|
||||
|
||||
fn decrease_font_size(&mut self) {
|
||||
self.scaling_changed(self.dimensions, self.fonts.get_font_scale() * 0.9);
|
||||
self.adjust_font_scale(self.fonts.get_font_scale() * 0.9);
|
||||
}
|
||||
fn increase_font_size(&mut self) {
|
||||
self.scaling_changed(self.dimensions, self.fonts.get_font_scale() * 1.1);
|
||||
self.adjust_font_scale(self.fonts.get_font_scale() * 1.1);
|
||||
}
|
||||
fn reset_font_size(&mut self) {
|
||||
self.scaling_changed(self.dimensions, 1.);
|
||||
self.adjust_font_scale(1.0);
|
||||
}
|
||||
|
||||
fn close_current_pane(&mut self, confirm: bool) {
|
||||
|
||||
Reference in new issue
Block a user