diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/config/CApi.zig | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/config/CApi.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/config/CApi.zig | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/vendor/libghostty-vt/src/config/CApi.zig b/vendor/libghostty-vt/src/config/CApi.zig index 7d3366c9..f69f48ea 100644 --- a/vendor/libghostty-vt/src/config/CApi.zig +++ b/vendor/libghostty-vt/src/config/CApi.zig @@ -1,7 +1,7 @@ const builtin = @import("builtin"); const std = @import("std"); const inputpkg = @import("../input.zig"); -const state = &@import("../global.zig").state; +const global = @import("../global.zig"); const String = @import("../main_c.zig").String; const Config = @import("Config.zig"); @@ -13,14 +13,14 @@ const log = std.log.scoped(.config); /// Create a new configuration filled with the initial default values. export fn ghostty_config_new() ?*Config { - const result = state.alloc.create(Config) catch |err| { + const result = global.alloc().create(Config) catch |err| { log.err("error allocating config err={}", .{err}); return null; }; - result.* = Config.default(state.alloc) catch |err| { + result.* = Config.default(global.alloc()) catch |err| { log.err("error creating config err={}", .{err}); - state.alloc.destroy(result); + global.alloc().destroy(result); return null; }; @@ -30,20 +30,20 @@ export fn ghostty_config_new() ?*Config { export fn ghostty_config_free(ptr: ?*Config) void { if (ptr) |v| { v.deinit(); - state.alloc.destroy(v); + global.alloc().destroy(v); } } /// Deep clone the configuration. export fn ghostty_config_clone(self: *Config) ?*Config { - const result = state.alloc.create(Config) catch |err| { + const result = global.alloc().create(Config) catch |err| { log.err("error allocating config err={}", .{err}); return null; }; - result.* = self.clone(state.alloc) catch |err| { + result.* = self.clone(global.alloc()) catch |err| { log.err("error cloning config err={}", .{err}); - state.alloc.destroy(result); + global.alloc().destroy(result); return null; }; @@ -52,7 +52,7 @@ export fn ghostty_config_clone(self: *Config) ?*Config { /// Load the configuration from the CLI args. export fn ghostty_config_load_cli_args(self: *Config) void { - self.loadCliArgs(state.alloc) catch |err| { + self.loadCliArgs(global.alloc()) catch |err| { log.err("error loading config err={}", .{err}); }; } @@ -61,7 +61,7 @@ export fn ghostty_config_load_cli_args(self: *Config) void { /// is usually done first. The default file locations are locations /// such as the home directory. export fn ghostty_config_load_default_files(self: *Config) void { - self.loadDefaultFiles(state.alloc) catch |err| { + self.loadDefaultFiles(global.alloc()) catch |err| { log.err("error loading config err={}", .{err}); }; } @@ -70,7 +70,7 @@ export fn ghostty_config_load_default_files(self: *Config) void { /// The path must be null-terminated. export fn ghostty_config_load_file(self: *Config, path: [*:0]const u8) void { const path_slice = std.mem.span(path); - self.loadFile(state.alloc, path_slice) catch |err| { + self.loadFile(global.alloc(), path_slice) catch |err| { log.err("error loading config from file path={s} err={}", .{ path_slice, err }); }; } @@ -79,7 +79,7 @@ export fn ghostty_config_load_file(self: *Config, path: [*:0]const u8) void { /// file locations in the previously loaded configuration. This will /// recursively continue to load up to a built-in limit. export fn ghostty_config_load_recursive_files(self: *Config) void { - self.loadRecursiveFiles(state.alloc) catch |err| { + self.loadRecursiveFiles(global.alloc()) catch |err| { log.err("error loading config err={}", .{err}); }; } @@ -133,7 +133,7 @@ export fn ghostty_config_get_diagnostic(self: *Config, idx: u32) Diagnostic { } export fn ghostty_config_open_path() String { - const path = edit.openPath(state.alloc) catch |err| { + const path = edit.openPath(global.alloc()) catch |err| { log.err("error opening config in editor err={}", .{err}); return .empty; }; |
