mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 23:21:08 +03:00
gui: work harder to preserve initial terminal size
I noticed that on macos, the initial terminal size didn't match the 80x24 default; it was a few columns short. I think I broke this with recent changes in window event dispatching. This commit passes the terminal size down to apply_dimensions just after we've set up the GL context to preserve the terminal size. Possibly related to https://github.com/wez/wezterm/issues/1002
This commit is contained in:
parent
6a7e6596b9
commit
b883627ba1
@ -315,7 +315,13 @@ impl TermWindow {
|
||||
// size adjusted GUI window dimensions and apply those to the dimensions
|
||||
// of the pty in the Mux layer.
|
||||
let dims = self.dimensions.clone();
|
||||
self.apply_dimensions(&dims, None);
|
||||
self.apply_dimensions(
|
||||
&dims,
|
||||
Some(resize::RowsAndCols {
|
||||
rows: self.terminal_size.rows as _,
|
||||
cols: self.terminal_size.cols as _,
|
||||
}),
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to create OpenGLRenderState: {}", err);
|
||||
|
@ -8,8 +8,8 @@ use wezterm_font::FontConfiguration;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct RowsAndCols {
|
||||
rows: usize,
|
||||
cols: usize,
|
||||
pub rows: usize,
|
||||
pub cols: usize,
|
||||
}
|
||||
|
||||
impl super::TermWindow {
|
||||
@ -23,10 +23,12 @@ impl super::TermWindow {
|
||||
if dimensions.pixel_width == 0 || dimensions.pixel_height == 0 {
|
||||
// on windows, this can happen when minimizing the window.
|
||||
// NOP!
|
||||
log::trace!("new dimensions are zero: NOP!");
|
||||
return;
|
||||
}
|
||||
if self.dimensions == dimensions && self.is_full_screen == is_full_screen {
|
||||
// It didn't really change
|
||||
log::trace!("dimensions didn't change NOP!");
|
||||
return;
|
||||
}
|
||||
self.is_full_screen = is_full_screen;
|
||||
@ -76,6 +78,11 @@ impl super::TermWindow {
|
||||
dimensions: &Dimensions,
|
||||
scale_changed_cells: Option<RowsAndCols>,
|
||||
) {
|
||||
log::trace!(
|
||||
"apply_dimensions {:?} scale_changed_cells {:?}",
|
||||
dimensions,
|
||||
scale_changed_cells
|
||||
);
|
||||
self.dimensions = *dimensions;
|
||||
|
||||
// Technically speaking, we should compute the rows and cols
|
||||
@ -141,6 +148,8 @@ impl super::TermWindow {
|
||||
(size, *dimensions)
|
||||
};
|
||||
|
||||
log::trace!("apply_dimensions computed size {:?}, dims {:?}", size, dims);
|
||||
|
||||
if self.render_state.is_some() {
|
||||
self.terminal_size = size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user