wezterm: add [Z] prefix to titlebar for zoomed panes

refs: #297
This commit is contained in:
Wez Furlong committed 2020-10-20 23:20:22 -07:00
1 parent fb9fb8230d
commit b0fdd15d35
2 files changed
+34 -20

No files matched your search

+4
View File
@@ -32,6 +32,8 @@ pub struct PositionedPane {
pub index: usize,
/// true if this is the active pane at the time the position was computed
pub is_active: bool,
/// true if this pane is zoomed
pub is_zoomed: bool,
/// The offset from the top left corner of the containing tab to the top
/// left corner of this pane, in cells.
pub left: usize,
@@ -549,6 +551,7 @@ impl Tab {
panes.push(PositionedPane {
index: 0,
is_active: true,
is_zoomed: true,
left: 0,
top: 0,
width: size.cols.into(),
@@ -590,6 +593,7 @@ impl Tab {
panes.push(PositionedPane {
index,
is_active: index == active_idx,
is_zoomed: false,
left,
top,
width: dims.cols as _,
+30 -20
View File
@@ -1306,28 +1306,37 @@ impl TermWindow {
let tab_no = window.get_active_idx();
drop(window);
let title = if let Some(pane) = self.get_active_pane_or_overlay() {
pane.get_title()
} else {
return;
};
let panes = self.get_panes_to_render();
if let Some(pos) = panes.iter().find(|p| p.is_active) {
let title = pos.pane.get_title();
if let Some(window) = self.window.as_ref() {
let show_tab_bar;
if num_tabs == 1 {
window.set_title(&title);
show_tab_bar = config.enable_tab_bar && !config.hide_tab_bar_if_only_one_tab;
} else {
window.set_title(&format!("[{}/{}] {}", tab_no + 1, num_tabs, title));
show_tab_bar = config.enable_tab_bar;
}
if let Some(window) = self.window.as_ref() {
let show_tab_bar;
if num_tabs == 1 {
window.set_title(&format!(
"{}{}",
if pos.is_zoomed { "[Z] " } else { "" },
title
));
show_tab_bar = config.enable_tab_bar && !config.hide_tab_bar_if_only_one_tab;
} else {
window.set_title(&format!(
"{}[{}/{}] {}",
if pos.is_zoomed { "[Z] " } else { "" },
tab_no + 1,
num_tabs,
title
));
show_tab_bar = config.enable_tab_bar;
}
// If the number of tabs changed and caused the tab bar to
// hide/show, then we'll need to resize things. It is simplest
// to piggy back on the config reloading code for that, so that
// is what we're doing.
if show_tab_bar != self.show_tab_bar {
self.config_was_reloaded();
// If the number of tabs changed and caused the tab bar to
// hide/show, then we'll need to resize things. It is simplest
// to piggy back on the config reloading code for that, so that
// is what we're doing.
if show_tab_bar != self.show_tab_bar {
self.config_was_reloaded();
}
}
}
}
@@ -3580,6 +3589,7 @@ impl TermWindow {
vec![PositionedPane {
index: 0,
is_active: true,
is_zoomed: false,
left: 0,
top: 0,
width: size.cols as _,