mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
config: add command-palette-entry config option
This commit is contained in:
committed by
Mitchell Hashimoto
parent
d419e5c922
commit
dbe6035da0
@@ -18,7 +18,7 @@ const Action = @import("Binding.zig").Action;
|
||||
pub const Command = struct {
|
||||
action: Action,
|
||||
title: [:0]const u8,
|
||||
description: [:0]const u8,
|
||||
description: [:0]const u8 = "",
|
||||
|
||||
/// ghostty_command_s
|
||||
pub const C = extern struct {
|
||||
@@ -28,6 +28,21 @@ pub const Command = struct {
|
||||
description: [*:0]const u8,
|
||||
};
|
||||
|
||||
pub fn clone(self: *const Command, alloc: Allocator) Allocator.Error!Command {
|
||||
return .{
|
||||
.action = try self.action.clone(alloc),
|
||||
.title = try alloc.dupeZ(u8, self.title),
|
||||
.description = try alloc.dupeZ(u8, self.description),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn equal(self: Command, other: Command) bool {
|
||||
if (self.action.hash() != other.action.hash()) return false;
|
||||
if (!std.mem.eql(u8, self.title, other.title)) return false;
|
||||
if (!std.mem.eql(u8, self.description, other.description)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Convert this command to a C struct.
|
||||
pub fn comptimeCval(self: Command) C {
|
||||
assert(@inComptime());
|
||||
|
||||
Reference in New Issue
Block a user