mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
0.13 conversions
This commit is contained in:
@ -1485,7 +1485,7 @@ fn root() []const u8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ANSI escape codes for colored log output
|
/// ANSI escape codes for colored log output
|
||||||
const color_map = std.ComptimeStringMap([]const u8, .{
|
const color_map = std.StaticStringMap([]const u8).initComptime(.{
|
||||||
&.{ "black", "30m" },
|
&.{ "black", "30m" },
|
||||||
&.{ "blue", "34m" },
|
&.{ "blue", "34m" },
|
||||||
&.{ "b", "1m" },
|
&.{ "b", "1m" },
|
||||||
|
@ -622,7 +622,10 @@ test "image load: rgb, not compressed, temporary file" {
|
|||||||
var tmp_dir = try internal_os.TempDir.init();
|
var tmp_dir = try internal_os.TempDir.init();
|
||||||
defer tmp_dir.deinit();
|
defer tmp_dir.deinit();
|
||||||
const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data");
|
const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data");
|
||||||
try tmp_dir.dir.writeFile("image.data", data);
|
try tmp_dir.dir.writeFile(.{
|
||||||
|
.sub_path = "image.data",
|
||||||
|
.data = data,
|
||||||
|
});
|
||||||
|
|
||||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
||||||
@ -656,7 +659,10 @@ test "image load: rgb, not compressed, regular file" {
|
|||||||
var tmp_dir = try internal_os.TempDir.init();
|
var tmp_dir = try internal_os.TempDir.init();
|
||||||
defer tmp_dir.deinit();
|
defer tmp_dir.deinit();
|
||||||
const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data");
|
const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data");
|
||||||
try tmp_dir.dir.writeFile("image.data", data);
|
try tmp_dir.dir.writeFile(.{
|
||||||
|
.sub_path = "image.data",
|
||||||
|
.data = data,
|
||||||
|
});
|
||||||
|
|
||||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
||||||
@ -688,7 +694,10 @@ test "image load: png, not compressed, regular file" {
|
|||||||
var tmp_dir = try internal_os.TempDir.init();
|
var tmp_dir = try internal_os.TempDir.init();
|
||||||
defer tmp_dir.deinit();
|
defer tmp_dir.deinit();
|
||||||
const data = @embedFile("testdata/image-png-none-50x76-2147483647-raw.data");
|
const data = @embedFile("testdata/image-png-none-50x76-2147483647-raw.data");
|
||||||
try tmp_dir.dir.writeFile("image.data", data);
|
try tmp_dir.dir.writeFile(.{
|
||||||
|
.sub_path = "image.data",
|
||||||
|
.data = data,
|
||||||
|
});
|
||||||
|
|
||||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
const path = try tmp_dir.dir.realpath("image.data", &buf);
|
||||||
|
@ -47,7 +47,7 @@ pub const MouseShape = enum(c_int) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const string_map = std.ComptimeStringMap(MouseShape, .{
|
const string_map = std.StaticStringMap(MouseShape).initComptime(.{
|
||||||
// W3C
|
// W3C
|
||||||
.{ "default", .default },
|
.{ "default", .default },
|
||||||
.{ "context-menu", .context_menu },
|
.{ "context-menu", .context_menu },
|
||||||
|
@ -5,7 +5,9 @@ const RGB = @import("color.zig").RGB;
|
|||||||
/// The map of all available X11 colors.
|
/// The map of all available X11 colors.
|
||||||
pub const map = colorMap() catch @compileError("failed to parse rgb.txt");
|
pub const map = colorMap() catch @compileError("failed to parse rgb.txt");
|
||||||
|
|
||||||
fn colorMap() !type {
|
pub const ColorMap = std.StaticStringMapWithEql(RGB, std.static_string_map.eqlAsciiIgnoreCase);
|
||||||
|
|
||||||
|
fn colorMap() !ColorMap {
|
||||||
@setEvalBranchQuota(100_000);
|
@setEvalBranchQuota(100_000);
|
||||||
|
|
||||||
const KV = struct { []const u8, RGB };
|
const KV = struct { []const u8, RGB };
|
||||||
@ -31,11 +33,7 @@ fn colorMap() !type {
|
|||||||
}
|
}
|
||||||
assert(i == len);
|
assert(i == len);
|
||||||
|
|
||||||
return std.ComptimeStringMapWithEql(
|
return ColorMap.initComptime(kvs);
|
||||||
RGB,
|
|
||||||
kvs,
|
|
||||||
std.comptime_string_map.eqlAsciiIgnoreCase,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is the rgb.txt file from the X11 project. This was last sourced
|
/// This is the rgb.txt file from the X11 project. This was last sourced
|
||||||
|
@ -68,7 +68,7 @@ pub fn encode(self: Source, writer: anytype) !void {
|
|||||||
/// Returns a ComptimeStringMap for all of the capabilities in this terminfo.
|
/// Returns a ComptimeStringMap for all of the capabilities in this terminfo.
|
||||||
/// The value is the value that should be sent as a response to XTGETTCAP.
|
/// The value is the value that should be sent as a response to XTGETTCAP.
|
||||||
/// Important: the value is the FULL response included the escape sequences.
|
/// Important: the value is the FULL response included the escape sequences.
|
||||||
pub fn xtgettcapMap(comptime self: Source) type {
|
pub fn xtgettcapMap(comptime self: Source) std.StaticStringMap([]const u8) {
|
||||||
const KV = struct { []const u8, []const u8 };
|
const KV = struct { []const u8, []const u8 };
|
||||||
|
|
||||||
// We have all of our capabilities plus To, TN, and RGB which aren't
|
// We have all of our capabilities plus To, TN, and RGB which aren't
|
||||||
@ -145,7 +145,7 @@ pub fn xtgettcapMap(comptime self: Source) type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const kvs_final = kvs;
|
const kvs_final = kvs;
|
||||||
return std.ComptimeStringMap([]const u8, &kvs_final);
|
return std.StaticStringMap([]const u8).initComptime(&kvs_final);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hexencode(comptime input: []const u8) []const u8 {
|
fn hexencode(comptime input: []const u8) []const u8 {
|
||||||
|
Reference in New Issue
Block a user