From 3d642461f8e7bc44759891a5ef87dc89b8214921 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 13 Mar 2021 09:31:13 -0800 Subject: [PATCH] fixup pty pixel size calculation Derive the pixels from the rows/cols rather than the available space. refs: https://github.com/wez/wezterm/issues/535 --- wezterm-gui/src/termwindow/resize.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wezterm-gui/src/termwindow/resize.rs b/wezterm-gui/src/termwindow/resize.rs index bf5170e72..d183d1d77 100644 --- a/wezterm-gui/src/termwindow/resize.rs +++ b/wezterm-gui/src/termwindow/resize.rs @@ -113,8 +113,12 @@ impl super::TermWindow { let size = PtySize { rows: rows as u16, cols: cols as u16, - pixel_height: avail_height as u16, - pixel_width: avail_width as u16, + // Take care to use the exact pixel dimensions of the cells, rather + // than the available space, so that apps that are sensitive to + // the pixels-per-cell have consistent values at a given font size. + // https://github.com/wez/wezterm/issues/535 + pixel_height: rows as u16 * self.render_metrics.cell_size.height as u16, + pixel_width: cols as u16 * self.render_metrics.cell_size.width as u16, }; (size, *dimensions)