From 3917fc21840eceec2cde433bf98b4967e2c70797 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 20 Aug 2022 22:34:19 -0700 Subject: [PATCH] tab bar: force x and + buttons to be square Use the font height as the basis for the size, rather than the width, to avoid the buttons being too condensed. Explicitly use the pixel height for the dimensions so that the buttons are square. refs: https://github.com/wez/wezterm/issues/2399 --- wezterm-gui/src/termwindow/render.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wezterm-gui/src/termwindow/render.rs b/wezterm-gui/src/termwindow/render.rs index 72b071130..788ddebd7 100644 --- a/wezterm-gui/src/termwindow/render.rs +++ b/wezterm-gui/src/termwindow/render.rs @@ -553,8 +553,8 @@ impl super::TermWindow { line_width: metrics.underline_height.max(2), poly: SizedPoly { poly: PLUS_BUTTON, - width: Dimension::Pixels(metrics.cell_size.width as f32 * 0.75), - height: Dimension::Pixels(metrics.cell_size.width as f32 * 0.75), + width: Dimension::Pixels(metrics.cell_size.height as f32 / 2.), + height: Dimension::Pixels(metrics.cell_size.height as f32 / 2.), }, }, ) @@ -733,8 +733,12 @@ impl super::TermWindow { line_width: metrics.underline_height.max(2), poly: SizedPoly { poly: X_BUTTON, - width: Dimension::Cells(0.5), - height: Dimension::Cells(0.5), + width: Dimension::Pixels( + metrics.cell_size.height as f32 / 2., + ), + height: Dimension::Pixels( + metrics.cell_size.height as f32 / 2., + ), }, }, )