mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
config: RepeatableString is null-terminated now
This makes it easier for these values to interface with C APIs
This commit is contained in:
@ -2203,11 +2203,11 @@ pub const RepeatableString = struct {
|
|||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
// Allocator for the list is the arena for the parent config.
|
// Allocator for the list is the arena for the parent config.
|
||||||
list: std.ArrayListUnmanaged([]const u8) = .{},
|
list: std.ArrayListUnmanaged([:0]const u8) = .{},
|
||||||
|
|
||||||
pub fn parseCLI(self: *Self, alloc: Allocator, input: ?[]const u8) !void {
|
pub fn parseCLI(self: *Self, alloc: Allocator, input: ?[]const u8) !void {
|
||||||
const value = input orelse return error.ValueRequired;
|
const value = input orelse return error.ValueRequired;
|
||||||
const copy = try alloc.dupe(u8, value);
|
const copy = try alloc.dupeZ(u8, value);
|
||||||
try self.list.append(alloc, copy);
|
try self.list.append(alloc, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2284,7 +2284,8 @@ pub const RepeatablePath = struct {
|
|||||||
|
|
||||||
// If it isn't absolute, we need to make it absolute relative
|
// If it isn't absolute, we need to make it absolute relative
|
||||||
// to the base.
|
// to the base.
|
||||||
const abs = dir.realpathAlloc(alloc, path) catch |err| {
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
|
const abs = std.os.realpath(path, &buf) catch |err| {
|
||||||
try errors.add(alloc, .{
|
try errors.add(alloc, .{
|
||||||
.message = try std.fmt.allocPrintZ(
|
.message = try std.fmt.allocPrintZ(
|
||||||
alloc,
|
alloc,
|
||||||
@ -2300,7 +2301,7 @@ pub const RepeatablePath = struct {
|
|||||||
"expanding config-file path relative={s} abs={s}",
|
"expanding config-file path relative={s} abs={s}",
|
||||||
.{ path, abs },
|
.{ path, abs },
|
||||||
);
|
);
|
||||||
self.value.list.items[i] = abs;
|
self.value.list.items[i] = try alloc.dupeZ(u8, abs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -142,7 +142,7 @@ pub const DerivedConfig = struct {
|
|||||||
arena: ArenaAllocator,
|
arena: ArenaAllocator,
|
||||||
|
|
||||||
font_thicken: bool,
|
font_thicken: bool,
|
||||||
font_features: std.ArrayListUnmanaged([]const u8),
|
font_features: std.ArrayListUnmanaged([:0]const u8),
|
||||||
font_styles: font.Group.StyleStatus,
|
font_styles: font.Group.StyleStatus,
|
||||||
cursor_color: ?terminal.color.RGB,
|
cursor_color: ?terminal.color.RGB,
|
||||||
cursor_opacity: f64,
|
cursor_opacity: f64,
|
||||||
@ -154,7 +154,7 @@ pub const DerivedConfig = struct {
|
|||||||
selection_foreground: ?terminal.color.RGB,
|
selection_foreground: ?terminal.color.RGB,
|
||||||
invert_selection_fg_bg: bool,
|
invert_selection_fg_bg: bool,
|
||||||
min_contrast: f32,
|
min_contrast: f32,
|
||||||
custom_shaders: std.ArrayListUnmanaged([]const u8),
|
custom_shaders: std.ArrayListUnmanaged([:0]const u8),
|
||||||
custom_shader_animation: bool,
|
custom_shader_animation: bool,
|
||||||
links: link.Set,
|
links: link.Set,
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ pub const DerivedConfig = struct {
|
|||||||
arena: ArenaAllocator,
|
arena: ArenaAllocator,
|
||||||
|
|
||||||
font_thicken: bool,
|
font_thicken: bool,
|
||||||
font_features: std.ArrayListUnmanaged([]const u8),
|
font_features: std.ArrayListUnmanaged([:0]const u8),
|
||||||
font_styles: font.Group.StyleStatus,
|
font_styles: font.Group.StyleStatus,
|
||||||
cursor_color: ?terminal.color.RGB,
|
cursor_color: ?terminal.color.RGB,
|
||||||
cursor_text: ?terminal.color.RGB,
|
cursor_text: ?terminal.color.RGB,
|
||||||
@ -251,7 +251,7 @@ pub const DerivedConfig = struct {
|
|||||||
selection_foreground: ?terminal.color.RGB,
|
selection_foreground: ?terminal.color.RGB,
|
||||||
invert_selection_fg_bg: bool,
|
invert_selection_fg_bg: bool,
|
||||||
min_contrast: f32,
|
min_contrast: f32,
|
||||||
custom_shaders: std.ArrayListUnmanaged([]const u8),
|
custom_shaders: std.ArrayListUnmanaged([:0]const u8),
|
||||||
custom_shader_animation: bool,
|
custom_shader_animation: bool,
|
||||||
links: link.Set,
|
links: link.Set,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user