mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-16 02:41:59 +00:00
Merge remote-tracking branch 'upstream/main' into jacob/uucode
This commit is contained in:
@@ -1213,7 +1213,7 @@ pub const Action = union(enum) {
|
||||
const value_info = @typeInfo(Value);
|
||||
switch (Value) {
|
||||
void => {},
|
||||
[]const u8 => try writer.print("{s}", .{value}),
|
||||
[]const u8 => try std.zig.stringEscape(value, "", .{}, writer),
|
||||
else => switch (value_info) {
|
||||
.@"enum" => try writer.print("{s}", .{@tagName(value)}),
|
||||
.float => try writer.print("{d}", .{value}),
|
||||
@@ -3227,3 +3227,18 @@ test "parse: set_font_size" {
|
||||
try testing.expectEqual(13.5, binding.action.set_font_size);
|
||||
}
|
||||
}
|
||||
|
||||
test "action: format" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
const a: Action = .{ .text = "👻" };
|
||||
|
||||
var buf: std.ArrayListUnmanaged(u8) = .empty;
|
||||
defer buf.deinit(alloc);
|
||||
|
||||
const writer = buf.writer(alloc);
|
||||
try a.format("", .{}, writer);
|
||||
|
||||
try testing.expectEqualStrings("text:\\xf0\\x9f\\x91\\xbb", buf.items);
|
||||
}
|
||||
|
||||
@@ -472,13 +472,18 @@ fn actionCommands(action: Action.Key) []const Command {
|
||||
.description = "Quit the application.",
|
||||
}},
|
||||
|
||||
.text => comptime &.{.{
|
||||
.action = .{ .text = "👻" },
|
||||
.title = "Ghostty",
|
||||
.description = "Put a little Ghostty in your terminal.",
|
||||
}},
|
||||
|
||||
// No commands because they're parameterized and there
|
||||
// aren't obvious values users would use. It is possible that
|
||||
// these may have commands in the future if there are very
|
||||
// common values that users tend to use.
|
||||
.csi,
|
||||
.esc,
|
||||
.text,
|
||||
.cursor_key,
|
||||
.set_font_size,
|
||||
.scroll_page_fractional,
|
||||
|
||||
Reference in New Issue
Block a user