1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-24 07:46:59 +03:00

gui: tidy up metrics/line widths for X and + tab bar buttons

This commit is contained in:
Wez Furlong 2021-12-29 08:42:58 -07:00
parent 5608e9477b
commit e5dd859ecc

View File

@ -470,6 +470,7 @@ impl super::TermWindow {
pub fn build_fancy_tab_bar(&self, palette: &ColorPalette) -> anyhow::Result<ComputedElement> { pub fn build_fancy_tab_bar(&self, palette: &ColorPalette) -> anyhow::Result<ComputedElement> {
let font = self.fonts.title_font()?; let font = self.fonts.title_font()?;
let metrics = RenderMetrics::with_font_metrics(&font.metrics());
let items = self.tab_bar.items(); let items = self.tab_bar.items();
let colors = self let colors = self
.config .config
@ -527,11 +528,11 @@ impl super::TermWindow {
TabBarItem::NewTabButton => Element::new( TabBarItem::NewTabButton => Element::new(
&font, &font,
ElementContent::Poly { ElementContent::Poly {
line_width: self.render_metrics.underline_height, line_width: metrics.underline_height.max(2),
poly: SizedPoly { poly: SizedPoly {
poly: PLUS_BUTTON, poly: PLUS_BUTTON,
width: Dimension::Cells(0.75), width: Dimension::Pixels(metrics.cell_size.width as f32 * 0.75),
height: Dimension::Cells(0.75), height: Dimension::Pixels(metrics.cell_size.width as f32 * 0.75),
}, },
}, },
) )
@ -686,7 +687,7 @@ impl super::TermWindow {
let x_button = Element::new( let x_button = Element::new(
&font, &font,
ElementContent::Poly { ElementContent::Poly {
line_width: self.render_metrics.underline_height, line_width: metrics.underline_height.max(2),
poly: SizedPoly { poly: SizedPoly {
poly: X_BUTTON, poly: X_BUTTON,
width: Dimension::Cells(0.5), width: Dimension::Cells(0.5),
@ -771,8 +772,6 @@ impl super::TermWindow {
.item_type(UIItemType::TabBar(TabBarItem::None)) .item_type(UIItemType::TabBar(TabBarItem::None))
.colors(bar_colors); .colors(bar_colors);
let metrics = RenderMetrics::with_font_metrics(&font.metrics());
let mut computed = self.compute_element( let mut computed = self.compute_element(
&LayoutContext { &LayoutContext {
height: DimensionContext { height: DimensionContext {