From 40b3d4c72ea77002f3b39a8dbfa0dd0ca80d94a8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Aug 2024 10:27:59 -0700 Subject: [PATCH] config: clarify padding color default --- src/config/Config.zig | 5 ++--- src/renderer/Metal.zig | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 379f47bd1..2e22d805a 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -712,10 +712,9 @@ keybind: Keybinds = .{}, /// * The nearest row is a prompt row (requires shell integration). The /// thinking here is that prompts often contain powerline glyphs that /// do not look good extended. +/// * The nearest row contains a perfect fit powerline character. These +/// don't look good extended. /// -/// The default value is "extend". This allows for smooth resizing of a -/// terminal grid without having visible empty areas around the edge. The edge -/// cells may appear slightly larger due to the extension. @"window-padding-color": WindowPaddingColor = .background, /// Synchronize rendering with the screen refresh rate. If true, this will diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index caedce13d..d22ab1cc3 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1955,13 +1955,19 @@ pub fn setScreenSize( }).add(padding); var padding_extend = self.uniforms.padding_extend; - if (self.config.padding_color == .extend) { - // If padding extension is enabled, we extend left and right always. - padding_extend.left = true; - padding_extend.right = true; - } else { - // Otherwise, disable all padding extension. - padding_extend = .{}; + switch (self.config.padding_color) { + .extend => { + // If padding extension is enabled, we extend left and right always + // because there is no downside to this. Up/down is dependent + // on some heuristics (see rebuildCells). + padding_extend.left = true; + padding_extend.right = true; + }, + + else => { + // Otherwise, disable all padding extension. + padding_extend = .{}; + }, } // Set the size of the drawable surface to the bounds @@ -2138,9 +2144,12 @@ fn rebuildCells( self.cells.reset(); // We also reset our padding extension depending on the screen type - if (self.config.padding_color == .extend) { - self.uniforms.padding_extend.up = screen_type == .alternate; - self.uniforms.padding_extend.down = screen_type == .alternate; + switch (self.config.padding_color) { + .background => {}, + .extend => { + self.uniforms.padding_extend.up = screen_type == .alternate; + self.uniforms.padding_extend.down = screen_type == .alternate; + }, } }