mirror of
https://github.com/wez/wezterm.git
synced 2024-11-10 15:04:32 +03:00
removed tab_bar_style options in favor of format-tab-title
refs: https://github.com/wez/wezterm/issues/647
This commit is contained in:
parent
0f2f3734d9
commit
be9c60bfc8
@ -184,19 +184,6 @@ impl Default for TabBarColors {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct TabBarStyle {
|
||||
#[serde(default = "default_tab_left")]
|
||||
pub active_tab_left: String,
|
||||
#[serde(default = "default_tab_right")]
|
||||
pub active_tab_right: String,
|
||||
#[serde(default = "default_tab_left")]
|
||||
pub inactive_tab_left: String,
|
||||
#[serde(default = "default_tab_right")]
|
||||
pub inactive_tab_right: String,
|
||||
#[serde(default = "default_tab_left")]
|
||||
pub inactive_tab_hover_left: String,
|
||||
#[serde(default = "default_tab_right")]
|
||||
pub inactive_tab_hover_right: String,
|
||||
|
||||
#[serde(default = "default_tab_left")]
|
||||
pub new_tab_left: String,
|
||||
#[serde(default = "default_tab_right")]
|
||||
@ -210,12 +197,6 @@ pub struct TabBarStyle {
|
||||
impl Default for TabBarStyle {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
active_tab_left: default_tab_left(),
|
||||
active_tab_right: default_tab_right(),
|
||||
inactive_tab_left: default_tab_left(),
|
||||
inactive_tab_right: default_tab_right(),
|
||||
inactive_tab_hover_left: default_tab_left(),
|
||||
inactive_tab_hover_right: default_tab_right(),
|
||||
new_tab_left: default_tab_left(),
|
||||
new_tab_right: default_tab_right(),
|
||||
new_tab_hover_left: default_tab_left(),
|
||||
|
@ -39,6 +39,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* Fixed: multi-cell glyphs weren't displayed in tab titles [#711](https://github.com/wez/wezterm/issues/711)
|
||||
* New: [format-window-title](config/lua/window-events/format-window-title.md) hook for customizing the text in the window titlebar
|
||||
* New: [format-tab-title](config/lua/window-events/format-tab-title.md) hook for customizing the text in tab titles. [#647](https://github.com/wez/wezterm/issues/647)
|
||||
* Removed: active and inactive [tab_bar_style](config/lua/config/tab_bar_style.md) config values; use the new [format-tab-title](config/lua/window-events/format-tab-title.md) event instead
|
||||
* New: [force_reverse_video_cursor](config/lua/config/force_reverse_video_cursor.md) setting to override the cursor color scheme settings. [#706](https://github.com/wez/wezterm/issues/706)
|
||||
* Fixed: ssh config parsing now expands `~` to your home directory for appropriate options; previously only `%d` and `${HOME}` were substituted. [#729](https://github.com/wez/wezterm/issues/729)
|
||||
* New: [Quick Select Mode](quickselect.md) for a tmux-fingers/tmux-thumbs style mouse-less select and copy flow [#732](https://github.com/wez/wezterm/issues/732)
|
||||
|
@ -1,9 +1,16 @@
|
||||
# `tab_bar_style`
|
||||
|
||||
*Since: nightly builds*
|
||||
|
||||
`active_tab_left`, `active_tab_right`, `inactive_tab_left`,
|
||||
`inactive_tab_right`, `inactive_tab_hover_left`, `inactive_tab_hover_right`
|
||||
have been removed and replaced by the more flexible
|
||||
[format-tab-title](../window-events/format-tab-title.md) event.
|
||||
|
||||
*Since: 20210314-114017-04b7cedd*
|
||||
|
||||
This config option allows styling the elements that appear in the tab bar.
|
||||
This configuration supplements the [tab bar color](../../../config/appearance.html#tab-bar-appearance--colors)
|
||||
This configuration supplements the [tab bar color](../../appearance.html#tab-bar-appearance--colors)
|
||||
options.
|
||||
|
||||
Styling in this context refers to how the edges of the tabs and the new tab button are rendered.
|
||||
|
@ -113,31 +113,6 @@ impl TabBarState {
|
||||
let inactive_hover_attrs = colors.inactive_tab_hover.as_cell_attributes();
|
||||
let inactive_cell_attrs = colors.inactive_tab.as_cell_attributes();
|
||||
|
||||
let active_tab_left = parse_status_text(
|
||||
&config.tab_bar_style.active_tab_left,
|
||||
active_cell_attrs.clone(),
|
||||
);
|
||||
let active_tab_right = parse_status_text(
|
||||
&config.tab_bar_style.active_tab_right,
|
||||
active_cell_attrs.clone(),
|
||||
);
|
||||
let inactive_tab_left = parse_status_text(
|
||||
&config.tab_bar_style.inactive_tab_left,
|
||||
inactive_cell_attrs.clone(),
|
||||
);
|
||||
let inactive_tab_right = parse_status_text(
|
||||
&config.tab_bar_style.inactive_tab_right,
|
||||
inactive_cell_attrs.clone(),
|
||||
);
|
||||
let inactive_tab_hover_left = parse_status_text(
|
||||
&config.tab_bar_style.inactive_tab_hover_left,
|
||||
inactive_hover_attrs.clone(),
|
||||
);
|
||||
let inactive_tab_hover_right = parse_status_text(
|
||||
&config.tab_bar_style.inactive_tab_hover_right,
|
||||
inactive_hover_attrs.clone(),
|
||||
);
|
||||
|
||||
let new_tab_left = parse_status_text(
|
||||
&config.tab_bar_style.new_tab_left,
|
||||
inactive_cell_attrs.clone(),
|
||||
@ -178,7 +153,7 @@ impl TabBarState {
|
||||
let mut title = pane.title.clone();
|
||||
if config.show_tab_index_in_tab_bar {
|
||||
title = format!(
|
||||
"{}: {}",
|
||||
" {}: {} ",
|
||||
tab.tab_index
|
||||
+ if config.tab_and_split_indices_are_zero_based {
|
||||
0
|
||||
@ -197,7 +172,7 @@ impl TabBarState {
|
||||
}
|
||||
TitleText::String(title)
|
||||
} else {
|
||||
TitleText::String("no pane".to_string())
|
||||
TitleText::String(" no pane ".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,9 +188,7 @@ impl TabBarState {
|
||||
let number_of_tabs = tab_titles.len();
|
||||
|
||||
let available_cells = title_width.saturating_sub(
|
||||
(number_of_tabs.saturating_sub(1)
|
||||
* (inactive_tab_left.len() + inactive_tab_right.len()))
|
||||
+ (new_tab_left.len() + new_tab_right.len() + 1),
|
||||
(number_of_tabs.saturating_sub(1)) + (new_tab_left.len() + new_tab_right.len() + 1),
|
||||
);
|
||||
let tab_width_max = if available_cells >= titles_len {
|
||||
// We can render each title with its full width
|
||||
@ -241,37 +214,19 @@ impl TabBarState {
|
||||
let active = tab_idx == active_tab_no;
|
||||
let hover = !active
|
||||
&& mouse_x
|
||||
.map(|mouse_x| {
|
||||
mouse_x >= x
|
||||
&& mouse_x
|
||||
< x + tab_title_len
|
||||
+ (inactive_tab_left.len() + inactive_tab_right.len())
|
||||
})
|
||||
.map(|mouse_x| mouse_x >= x && mouse_x < x + tab_title_len)
|
||||
.unwrap_or(false);
|
||||
|
||||
let (cell_attrs, left, right) = if active {
|
||||
(&active_cell_attrs, &active_tab_left, &active_tab_right)
|
||||
let cell_attrs = if active {
|
||||
&active_cell_attrs
|
||||
} else if hover {
|
||||
(
|
||||
&inactive_hover_attrs,
|
||||
&inactive_tab_hover_left,
|
||||
&inactive_tab_hover_right,
|
||||
)
|
||||
&inactive_hover_attrs
|
||||
} else {
|
||||
(
|
||||
&inactive_cell_attrs,
|
||||
&inactive_tab_left,
|
||||
&inactive_tab_right,
|
||||
)
|
||||
&inactive_cell_attrs
|
||||
};
|
||||
|
||||
let tab_start_idx = x;
|
||||
|
||||
for c in left {
|
||||
line.set_cell(x, c.clone());
|
||||
x += 1;
|
||||
}
|
||||
|
||||
let hover_title;
|
||||
let tab_title = if hover {
|
||||
match call_format_tab_title(&tab_info[tab_idx], tab_info, pane_info, config, hover)
|
||||
@ -320,11 +275,6 @@ impl TabBarState {
|
||||
}
|
||||
}
|
||||
|
||||
for c in right {
|
||||
line.set_cell(x, c.clone());
|
||||
x += 1;
|
||||
}
|
||||
|
||||
items.push(TabEntry {
|
||||
item: TabBarItem::Tab(tab_idx),
|
||||
x: tab_start_idx,
|
||||
|
Loading…
Reference in New Issue
Block a user