mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Cleaning up to be able to do this in windows
This commit is contained in:
@ -18,6 +18,7 @@ pub const Message = apprt.surface.Message;
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
|
const getenv = @import("os/env.zig").getenv;
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||||
const global_state = &@import("global.zig").state;
|
const global_state = &@import("global.zig").state;
|
||||||
@ -4321,17 +4322,17 @@ fn openScreenFile(
|
|||||||
self: *Surface,
|
self: *Surface,
|
||||||
file_path: []const u8,
|
file_path: []const u8,
|
||||||
) !void {
|
) !void {
|
||||||
const editor = std.posix.getenv("EDITOR") orelse {
|
const editor = getenv(self.alloc, "EDITOR") catch |err| {
|
||||||
std.log.debug("EDITOR environment variable not set", .{});
|
return err;
|
||||||
return error.EnvironmentVariableNotFound;
|
|
||||||
};
|
};
|
||||||
|
if (editor) |res| {
|
||||||
const command = try std.fmt.allocPrint(self.alloc, "{s} {s}\n", .{ editor, file_path });
|
const command = try std.fmt.allocPrint(self.alloc, "{s} {s}\n", .{ res.value, file_path });
|
||||||
self.io.queueMessage(try termio.Message.writeReq(
|
self.io.queueMessage(try termio.Message.writeReq(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
command,
|
command,
|
||||||
), .unlocked);
|
), .unlocked);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The portion of the screen to write for writeScreenFile.
|
/// The portion of the screen to write for writeScreenFile.
|
||||||
const WriteScreenLoc = enum {
|
const WriteScreenLoc = enum {
|
||||||
|
Reference in New Issue
Block a user