From 0242cb7007be2e21097c092857e1d78dac97abc6 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 8 Feb 2020 15:37:58 -0800 Subject: [PATCH] Add a minimum tab width for the tab bar This is a soft minimum rather than a hard minimum, and is not configurable. refs: https://github.com/wez/wezterm/issues/147 --- src/frontend/gui/tabbar.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontend/gui/tabbar.rs b/src/frontend/gui/tabbar.rs index 2f6f60b47..b6ca30e39 100644 --- a/src/frontend/gui/tabbar.rs +++ b/src/frontend/gui/tabbar.rs @@ -57,7 +57,17 @@ impl TabBarState { let per_tab_overhead = 2; let system_overhead = 3; - let tab_titles: Vec<_> = window.iter().map(|w| w.get_title()).collect(); + let tab_titles: Vec<_> = window.iter().map(|w| { + let mut title = w.get_title(); + // We have a preferred soft minimum on tab width to make it + // easier to click on tab titles, but we'll still go below + // this if there are too many tabs to fit the window at + // this width. + while title.len() < 5 { + title.push(' '); + } + title + }).collect(); let titles_len: usize = tab_titles.iter().map(|s| unicode_column_width(s)).sum(); let number_of_tabs = tab_titles.len();