diff --git a/wezterm-gui/src/termwindow/render.rs b/wezterm-gui/src/termwindow/render.rs index 0b639ed27..2a4b8d996 100644 --- a/wezterm-gui/src/termwindow/render.rs +++ b/wezterm-gui/src/termwindow/render.rs @@ -1395,11 +1395,9 @@ impl super::TermWindow { config.text_background_opacity }); - if num_panes > 1 && self.window_background.is_empty() { - // Per-pane, palette-specified background - let cell_width = self.render_metrics.cell_size.width as f32; - let cell_height = self.render_metrics.cell_size.height as f32; - + let cell_width = self.render_metrics.cell_size.width as f32; + let cell_height = self.render_metrics.cell_size.height as f32; + let background_rect = { // We want to fill out to the edges of the splits let (x, width_delta) = if pos.left == 0 { ( @@ -1425,26 +1423,31 @@ impl super::TermWindow { cell_height, ) }; + euclid::rect( + x, + y, + // Go all the way to the right edge if we're right-most + if pos.left + pos.width >= self.terminal_size.cols as usize { + self.dimensions.pixel_width as f32 - x + } else { + (pos.width as f32 * cell_width) + width_delta + }, + // Go all the way to the bottom if we're bottom-most + if pos.top + pos.height >= self.terminal_size.rows as usize { + self.dimensions.pixel_height as f32 - y + } else { + (pos.height as f32 * cell_height) + height_delta as f32 + }, + ) + }; + + if num_panes > 1 && self.window_background.is_empty() { + // Per-pane, palette-specified background let mut quad = self.filled_rectangle( layers, 0, - euclid::rect( - x, - y, - // Go all the way to the right edge if we're right-most - if pos.left + pos.width >= self.terminal_size.cols as usize { - self.dimensions.pixel_width as f32 - x - } else { - (pos.width as f32 * cell_width) + width_delta - }, - // Go all the way to the bottom if we're bottom-most - if pos.top + pos.height >= self.terminal_size.rows as usize { - self.dimensions.pixel_height as f32 - y - } else { - (pos.height as f32 * cell_height) + height_delta as f32 - }, - ), + background_rect, palette .background .to_linear() @@ -1494,56 +1497,7 @@ impl super::TermWindow { }; log::trace!("bell color is {:?}", background); - let cell_width = self.render_metrics.cell_size.width as f32; - let cell_height = self.render_metrics.cell_size.height as f32; - - // We want to fill out to the edges of the splits - let (x, width_delta) = if pos.left == 0 { - ( - 0., - padding_left + border.left.get() as f32 + (cell_width / 2.0), - ) - } else { - ( - padding_left + border.left.get() as f32 - (cell_width / 2.0) - + (pos.left as f32 * cell_width), - cell_width, - ) - }; - - let (y, height_delta) = if pos.top == 0 { - ( - (top_pixel_y - padding_top), - padding_top + (cell_height / 2.0), - ) - } else { - ( - top_pixel_y + (pos.top as f32 * cell_height) - (cell_height / 2.0), - cell_height, - ) - }; - - let mut quad = self.filled_rectangle( - layers, - 0, - euclid::rect( - x, - y, - // Go all the way to the right edge if we're right-most - if pos.left + pos.width >= self.terminal_size.cols as usize { - self.dimensions.pixel_width as f32 - x - } else { - (pos.width as f32 * cell_width) + width_delta - }, - // Go all the way to the bottom if we're bottom-most - if pos.top + pos.height >= self.terminal_size.rows as usize { - self.dimensions.pixel_height as f32 - y - } else { - (pos.height as f32 * cell_height) + height_delta as f32 - }, - ), - background, - )?; + let mut quad = self.filled_rectangle(layers, 0, background_rect, background)?; quad.set_hsv(if pos.is_active { None