tab bar: fixup placement of macos native titlebar buttons
This commit is contained in:
2 files changed
+26
-11
No files matched your search
@@ -358,13 +358,6 @@ impl TabBarState {
|
||||
let mut x = 0;
|
||||
let mut items = vec![];
|
||||
|
||||
if use_integrated_title_buttons
|
||||
&& config.integrated_title_button_style != IntegratedTitleButtonStyle::MacOsNative
|
||||
&& config.integrated_title_button_alignment == IntegratedTitleButtonAlignment::Left
|
||||
{
|
||||
Self::integrated_title_buttons(mouse_x, &mut x, config, &mut items, &mut line, &colors);
|
||||
}
|
||||
|
||||
let black_cell = Cell::blank_with_attrs(
|
||||
CellAttributes::default()
|
||||
.set_background(ColorSpec::TrueColor(*colors.background()))
|
||||
@@ -376,11 +369,18 @@ impl TabBarState {
|
||||
&& config.use_fancy_tab_bar == false
|
||||
{
|
||||
for _ in 0..10 as usize {
|
||||
line.insert_cell(x, black_cell.clone(), title_width, SEQ_ZERO);
|
||||
line.insert_cell(0, black_cell.clone(), title_width, SEQ_ZERO);
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if use_integrated_title_buttons
|
||||
&& config.integrated_title_button_style != IntegratedTitleButtonStyle::MacOsNative
|
||||
&& config.integrated_title_button_alignment == IntegratedTitleButtonAlignment::Left
|
||||
{
|
||||
Self::integrated_title_buttons(mouse_x, &mut x, config, &mut items, &mut line, &colors);
|
||||
}
|
||||
|
||||
let left_status_line = parse_status_text(left_status, black_cell.attrs().clone());
|
||||
if left_status_line.len() > 0 {
|
||||
items.push(TabEntry {
|
||||
@@ -549,17 +549,15 @@ impl TabBarState {
|
||||
|
||||
pub fn compute_ui_items(&self, y: usize, cell_height: usize, cell_width: usize) -> Vec<UIItem> {
|
||||
let mut items = vec![];
|
||||
let mut last_x = 0;
|
||||
|
||||
for entry in self.items.iter() {
|
||||
items.push(UIItem {
|
||||
x: last_x * cell_width,
|
||||
x: entry.x * cell_width,
|
||||
width: entry.width * cell_width,
|
||||
y,
|
||||
height: cell_height,
|
||||
item_type: UIItemType::TabBar(entry.item),
|
||||
});
|
||||
last_x += entry.width;
|
||||
}
|
||||
|
||||
items
|
||||
|
||||
@@ -1156,6 +1156,23 @@ impl super::TermWindow {
|
||||
- (1.5 * metrics.cell_size.width as f32))
|
||||
.max(0.);
|
||||
|
||||
// Reserve space for the native titlebar buttons
|
||||
if self
|
||||
.config
|
||||
.window_decorations
|
||||
.contains(::window::WindowDecorations::INTEGRATED_BUTTONS)
|
||||
&& self.config.integrated_title_button_style == IntegratedTitleButtonStyle::MacOsNative
|
||||
{
|
||||
left_status.push(
|
||||
Element::new(&font, ElementContent::Text("".to_string())).margin(BoxDimension {
|
||||
left: Dimension::Cells(4.0), // FIXME: determine exact width of macos ... buttons
|
||||
right: Dimension::Cells(0.),
|
||||
top: Dimension::Cells(0.),
|
||||
bottom: Dimension::Cells(0.),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
for item in items {
|
||||
match item.item {
|
||||
TabBarItem::LeftStatus => left_status.push(item_to_elem(item)),
|
||||
|
||||
Reference in new issue
Block a user