mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
cli(list-keybinds): format key sequences
Implement formatting of key sequences in the list-keybinds command when *not* pretty printing. Pretty printing will come in a separate commit. The print style for that needs some thought, but in the meantime this removes the panic cause by redirecting output of the command.
This commit is contained in:
@ -3430,7 +3430,7 @@ pub const Keybinds = struct {
|
||||
[]const u8,
|
||||
std.fmt.bufPrint(
|
||||
&buf,
|
||||
"{}={}",
|
||||
"{}{}",
|
||||
.{ k, v },
|
||||
) catch return error.OutOfMemory,
|
||||
);
|
||||
|
@ -800,11 +800,20 @@ pub const Set = struct {
|
||||
_ = opts;
|
||||
|
||||
switch (self) {
|
||||
.leader => @panic("TODO"),
|
||||
.leader => |set| {
|
||||
// the leader key was already printed.
|
||||
var iter = set.bindings.iterator();
|
||||
while (iter.next()) |binding| {
|
||||
try writer.print(
|
||||
">{s}{s}",
|
||||
.{ binding.key_ptr.*, binding.value_ptr.* },
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
.action, .action_unconsumed => |action| {
|
||||
// action implements the format
|
||||
try writer.print("{s}", .{action});
|
||||
try writer.print("={s}", .{action});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user