aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/config/theme.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/config/theme.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/config/theme.zig')
-rw-r--r--vendor/libghostty-vt/src/config/theme.zig28
1 files changed, 16 insertions, 12 deletions
diff --git a/vendor/libghostty-vt/src/config/theme.zig b/vendor/libghostty-vt/src/config/theme.zig
index 8776fb1b..a8c39cad 100644
--- a/vendor/libghostty-vt/src/config/theme.zig
+++ b/vendor/libghostty-vt/src/config/theme.zig
@@ -1,9 +1,9 @@
const std = @import("std");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
-const global_state = &@import("../global.zig").state;
const internal_os = @import("../os/main.zig");
const cli = @import("../cli.zig");
+const global = @import("../global.zig");
/// Location of possible themes. The order of this enum matters because it
/// defines the priority of theme search (from top to bottom).
@@ -23,7 +23,9 @@ pub const Location = enum {
pub fn dir(
self: Location,
arena_alloc: Allocator,
- ) error{OutOfMemory}!?[]const u8 {
+ ) error{ OutOfMemory, Unexpected }!?[]const u8 {
+ var environ_map = try global.environMap();
+ defer environ_map.deinit();
return switch (self) {
.user => user: {
const subdir = std.fs.path.join(arena_alloc, &.{
@@ -31,7 +33,9 @@ pub const Location = enum {
}) catch return error.OutOfMemory;
break :user internal_os.xdg.config(
+ global.io(),
arena_alloc,
+ &environ_map,
.{ .subdir = subdir },
) catch |err| {
// We need to do some comptime tricks to get the right
@@ -55,7 +59,7 @@ pub const Location = enum {
},
.resources => try std.fs.path.join(arena_alloc, &.{
- global_state.resources_dir.app() orelse return null,
+ global.resourcesDir().app() orelse return null,
"themes",
}),
};
@@ -111,18 +115,18 @@ pub fn open(
arena_alloc: Allocator,
theme: []const u8,
diags: *cli.DiagnosticList,
-) error{OutOfMemory}!?struct {
+) error{ OutOfMemory, Unexpected }!?struct {
path: []const u8,
- file: std.fs.File,
+ file: std.Io.File,
} {
// Absolute themes are loaded a different path.
if (std.fs.path.isAbsolute(theme)) {
- const file: std.fs.File = try openAbsolute(
+ const file: std.Io.File = try openAbsolute(
arena_alloc,
theme,
diags,
) orelse return null;
- const stat = file.stat() catch |err| {
+ const stat = file.stat(global.io()) catch |err| {
try diags.append(arena_alloc, .{
.message = try std.fmt.allocPrintSentinel(
arena_alloc,
@@ -166,11 +170,11 @@ pub fn open(
// Iterate over the possible locations to try to find the
// one that exists.
var it: LocationIterator = .{ .arena_alloc = arena_alloc };
- const cwd = std.fs.cwd();
+ const cwd = std.Io.Dir.cwd();
while (try it.next()) |loc| {
const path = try std.fs.path.join(arena_alloc, &.{ loc.dir, theme });
- if (cwd.openFile(path, .{})) |file| {
- const stat = file.stat() catch |err| {
+ if (cwd.openFile(global.io(), path, .{})) |file| {
+ const stat = file.stat(global.io()) catch |err| {
try diags.append(arena_alloc, .{
.message = try std.fmt.allocPrintSentinel(
arena_alloc,
@@ -251,8 +255,8 @@ pub fn openAbsolute(
arena_alloc: Allocator,
theme: []const u8,
diags: *cli.DiagnosticList,
-) error{OutOfMemory}!?std.fs.File {
- return std.fs.openFileAbsolute(theme, .{}) catch |err| {
+) error{OutOfMemory}!?std.Io.File {
+ return std.Io.Dir.openFileAbsolute(global.io(), theme, .{}) catch |err| {
switch (err) {
error.FileNotFound => try diags.append(arena_alloc, .{
.message = try std.fmt.allocPrintSentinel(