mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
config: add window-padding-color=extend-always to force always
This commit is contained in:
@ -701,6 +701,8 @@ keybind: Keybinds = .{},
|
|||||||
///
|
///
|
||||||
/// * `background` - The background color specified in `background`.
|
/// * `background` - The background color specified in `background`.
|
||||||
/// * `extend` - Extend the background color of the nearest grid cell.
|
/// * `extend` - Extend the background color of the nearest grid cell.
|
||||||
|
/// * `extend-always` - Same as "extend" but always extends without applying
|
||||||
|
/// any of the heuristics that disable extending noted below.
|
||||||
///
|
///
|
||||||
/// The "extend" value will be disabled in certain scenarios. On primary
|
/// The "extend" value will be disabled in certain scenarios. On primary
|
||||||
/// screen applications (i.e. not something like Neovim), the color will not
|
/// screen applications (i.e. not something like Neovim), the color will not
|
||||||
@ -2729,6 +2731,7 @@ pub const OptionAsAlt = enum {
|
|||||||
pub const WindowPaddingColor = enum {
|
pub const WindowPaddingColor = enum {
|
||||||
background,
|
background,
|
||||||
extend,
|
extend,
|
||||||
|
@"extend-always",
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Color represents a color using RGB.
|
/// Color represents a color using RGB.
|
||||||
|
@ -1964,7 +1964,14 @@ pub fn setScreenSize(
|
|||||||
padding_extend.right = true;
|
padding_extend.right = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
else => {
|
.@"extend-always" => {
|
||||||
|
padding_extend.up = true;
|
||||||
|
padding_extend.down = true;
|
||||||
|
padding_extend.left = true;
|
||||||
|
padding_extend.right = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
.background => {
|
||||||
// Otherwise, disable all padding extension.
|
// Otherwise, disable all padding extension.
|
||||||
padding_extend = .{};
|
padding_extend = .{};
|
||||||
},
|
},
|
||||||
@ -2146,10 +2153,20 @@ fn rebuildCells(
|
|||||||
// We also reset our padding extension depending on the screen type
|
// We also reset our padding extension depending on the screen type
|
||||||
switch (self.config.padding_color) {
|
switch (self.config.padding_color) {
|
||||||
.background => {},
|
.background => {},
|
||||||
|
|
||||||
.extend => {
|
.extend => {
|
||||||
self.uniforms.padding_extend.up = screen_type == .alternate;
|
self.uniforms.padding_extend.up = screen_type == .alternate;
|
||||||
self.uniforms.padding_extend.down = screen_type == .alternate;
|
self.uniforms.padding_extend.down = screen_type == .alternate;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.@"extend-always" => {
|
||||||
|
self.uniforms.padding_extend = .{
|
||||||
|
.up = true,
|
||||||
|
.down = true,
|
||||||
|
.left = true,
|
||||||
|
.right = true,
|
||||||
|
};
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2187,12 +2204,16 @@ fn rebuildCells(
|
|||||||
// under certain conditions we feel are safe. This helps make some
|
// under certain conditions we feel are safe. This helps make some
|
||||||
// scenarios look better while avoiding scenarios we know do NOT look
|
// scenarios look better while avoiding scenarios we know do NOT look
|
||||||
// good.
|
// good.
|
||||||
if (self.config.padding_color == .extend) {
|
switch (self.config.padding_color) {
|
||||||
if (y == 0 and screen_type == .primary) {
|
// These already have the correct values set above.
|
||||||
|
.background, .@"extend-always" => {},
|
||||||
|
|
||||||
|
// Apply heuristics for padding extension.
|
||||||
|
.extend => if (y == 0 and screen_type == .primary) {
|
||||||
self.uniforms.padding_extend.up = !row.neverExtendBg();
|
self.uniforms.padding_extend.up = !row.neverExtendBg();
|
||||||
} else if (y == self.cells.size.rows - 1 and screen_type == .primary) {
|
} else if (y == self.cells.size.rows - 1 and screen_type == .primary) {
|
||||||
self.uniforms.padding_extend.down = !row.neverExtendBg();
|
self.uniforms.padding_extend.down = !row.neverExtendBg();
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split our row into runs and shape each one.
|
// Split our row into runs and shape each one.
|
||||||
|
@ -169,7 +169,7 @@ const SetScreenSize = struct {
|
|||||||
// clear color.
|
// clear color.
|
||||||
.background => .{},
|
.background => .{},
|
||||||
|
|
||||||
.extend => self.size.blankPadding(padding, grid_size, .{
|
.extend, .@"extend-always" => self.size.blankPadding(padding, grid_size, .{
|
||||||
.width = r.grid_metrics.cell_width,
|
.width = r.grid_metrics.cell_width,
|
||||||
.height = r.grid_metrics.cell_height,
|
.height = r.grid_metrics.cell_height,
|
||||||
}).add(padding),
|
}).add(padding),
|
||||||
@ -1213,9 +1213,19 @@ pub fn rebuildCells(
|
|||||||
var cursor_cell: ?CellProgram.Cell = null;
|
var cursor_cell: ?CellProgram.Cell = null;
|
||||||
|
|
||||||
if (rebuild) {
|
if (rebuild) {
|
||||||
// We also reset our padding extension depending on the screen type
|
switch (self.config.padding_color) {
|
||||||
self.padding_extend_top = screen_type == .alternate;
|
.background => {},
|
||||||
self.padding_extend_bottom = screen_type == .alternate;
|
|
||||||
|
.extend => {
|
||||||
|
self.padding_extend_top = screen_type == .alternate;
|
||||||
|
self.padding_extend_bottom = screen_type == .alternate;
|
||||||
|
},
|
||||||
|
|
||||||
|
.@"extend-always" => {
|
||||||
|
self.padding_extend_top = true;
|
||||||
|
self.padding_extend_bottom = true;
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build each cell
|
// Build each cell
|
||||||
@ -1268,10 +1278,16 @@ pub fn rebuildCells(
|
|||||||
// under certain conditions we feel are safe. This helps make some
|
// under certain conditions we feel are safe. This helps make some
|
||||||
// scenarios look better while avoiding scenarios we know do NOT look
|
// scenarios look better while avoiding scenarios we know do NOT look
|
||||||
// good.
|
// good.
|
||||||
if (y == 0 and screen_type == .primary) {
|
switch (self.config.padding_color) {
|
||||||
self.padding_extend_top = !row.neverExtendBg();
|
// These already have the correct values set above.
|
||||||
} else if (y == self.grid_size.rows - 1 and screen_type == .primary) {
|
.background, .@"extend-always" => {},
|
||||||
self.padding_extend_bottom = !row.neverExtendBg();
|
|
||||||
|
// Apply heuristics for padding extension.
|
||||||
|
.extend => if (y == 0 and screen_type == .primary) {
|
||||||
|
self.padding_extend_top = !row.neverExtendBg();
|
||||||
|
} else if (y == self.grid_size.rows - 1 and screen_type == .primary) {
|
||||||
|
self.padding_extend_bottom = !row.neverExtendBg();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split our row into runs and shape each one.
|
// Split our row into runs and shape each one.
|
||||||
|
Reference in New Issue
Block a user