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
This commit is contained in:
Wez Furlong committed 2020-02-10 22:14:15 -08:00
1 parent dedce44c54
commit 0242cb7007
1 file changed
+11 -1
+11 -1
View File
@@ -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();