mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
Merge pull request #2703 from furtidev/port-to-latest-vaxis
cli: update to latest libvaxis and fix `+list-themes` bugs
This commit is contained in:
@ -1238,8 +1238,6 @@ fn addDeps(
|
||||
step.root_module.addImport("vaxis", b.dependency("vaxis", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.libxev = false,
|
||||
.images = false,
|
||||
}).module("vaxis"));
|
||||
step.root_module.addImport("wuffs", b.dependency("wuffs", .{
|
||||
.target = target,
|
||||
@ -1261,6 +1259,7 @@ fn addDeps(
|
||||
step.root_module.addImport("zf", b.dependency("zf", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.with_tui = false,
|
||||
}).module("zf"));
|
||||
|
||||
// Mac Stuff
|
||||
|
@ -53,12 +53,12 @@
|
||||
.hash = "1220217ae916146a4c598f8ba5bfff0ff940335d00572e337f20b4accf24fa2ca4fc",
|
||||
},
|
||||
.vaxis = .{
|
||||
.url = "https://github.com/rockorager/libvaxis/archive/refs/tags/v0.5.1.tar.gz",
|
||||
.hash = "1220de23a3240e503397ea579de4fd85db422f537e10036ef74717c50164475813ce",
|
||||
.url = "git+https://github.com/rockorager/libvaxis/?ref=main#6d729a2dc3b934818dffe06d2ba3ce02841ed74b",
|
||||
.hash = "12200df4ebeaed45de26cb2c9f3b6f3746d8013b604e035dae658f86f586c8c91d2f",
|
||||
},
|
||||
.zf = .{
|
||||
.url = "https://github.com/natecraddock/zf/archive/refs/tags/0.10.2.tar.gz",
|
||||
.hash = "1220014ae47a57902e90aa7b4ff9751832ba1f426d7b138580db06859e0e9b51dfe5",
|
||||
.url = "git+https://github.com/natecraddock/zf/?ref=main#ed99ca18b02dda052e20ba467e90b623c04690dd",
|
||||
.hash = "1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8",
|
||||
},
|
||||
.z2d = .{
|
||||
.url = "git+https://github.com/vancluever/z2d?ref=main#285a796eb9c25a2389f087d008f0e60faf0b8eda",
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This file is auto-generated! check build-support/check-zig-cache-hash.sh for
|
||||
# more details.
|
||||
"sha256-uQY8KYNPqwVH+LFXXqVGNYZdG2imeCZoamJf7bMokX4="
|
||||
"sha256-D1SQIlmdP9x1PDgRVOy1qJGmu9osDbuyxGOcFj646N4="
|
||||
|
@ -111,7 +111,7 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
||||
// align things nicely
|
||||
var iter = keybinds.set.bindings.iterator();
|
||||
var bindings = std.ArrayList(Binding).init(alloc);
|
||||
var widest_key: usize = 0;
|
||||
var widest_key: u16 = 0;
|
||||
var buf: [64]u8 = undefined;
|
||||
while (iter.next()) |bind| {
|
||||
const action = switch (bind.value_ptr.*) {
|
||||
@ -134,7 +134,7 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
||||
const alt_style: vaxis.Style = .{ .fg = .{ .index = 3 } };
|
||||
const shift_style: vaxis.Style = .{ .fg = .{ .index = 4 } };
|
||||
|
||||
var longest_col: usize = 0;
|
||||
var longest_col: u16 = 0;
|
||||
|
||||
// Print the list
|
||||
for (bindings.items) |bind| {
|
||||
@ -143,20 +143,20 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
||||
var result: vaxis.Window.PrintResult = .{ .col = 0, .row = 0, .overflow = false };
|
||||
const trigger = bind.trigger;
|
||||
if (trigger.mods.super) {
|
||||
result = try win.printSegment(.{ .text = "super", .style = super_style }, .{ .col_offset = result.col });
|
||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = "super", .style = super_style }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
}
|
||||
if (trigger.mods.ctrl) {
|
||||
result = try win.printSegment(.{ .text = "ctrl ", .style = ctrl_style }, .{ .col_offset = result.col });
|
||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = "ctrl ", .style = ctrl_style }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
}
|
||||
if (trigger.mods.alt) {
|
||||
result = try win.printSegment(.{ .text = "alt ", .style = alt_style }, .{ .col_offset = result.col });
|
||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = "alt ", .style = alt_style }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
}
|
||||
if (trigger.mods.shift) {
|
||||
result = try win.printSegment(.{ .text = "shift", .style = shift_style }, .{ .col_offset = result.col });
|
||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = "shift", .style = shift_style }, .{ .col_offset = result.col });
|
||||
result = win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||
}
|
||||
|
||||
const key = switch (trigger.key) {
|
||||
@ -166,20 +166,20 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
||||
};
|
||||
// We don't track the key print because we index the action off the *widest* key so we get
|
||||
// nice alignment no matter what was printed for mods
|
||||
_ = try win.printSegment(.{ .text = key }, .{ .col_offset = result.col });
|
||||
_ = win.printSegment(.{ .text = key }, .{ .col_offset = result.col });
|
||||
|
||||
if (longest_col < result.col) longest_col = result.col;
|
||||
|
||||
const action = try std.fmt.allocPrint(alloc, "{}", .{bind.action});
|
||||
// If our action has an argument, we print the argument in a different color
|
||||
if (std.mem.indexOfScalar(u8, action, ':')) |idx| {
|
||||
_ = try win.print(&.{
|
||||
_ = win.print(&.{
|
||||
.{ .text = action[0..idx] },
|
||||
.{ .text = action[idx .. idx + 1], .style = .{ .dim = true } },
|
||||
.{ .text = action[idx + 1 ..], .style = .{ .fg = .{ .index = 5 } } },
|
||||
}, .{ .col_offset = longest_col + widest_key + 2 });
|
||||
} else {
|
||||
_ = try win.printSegment(.{ .text = action }, .{ .col_offset = longest_col + widest_key + 2 });
|
||||
_ = win.printSegment(.{ .text = action }, .{ .col_offset = longest_col + widest_key + 2 });
|
||||
}
|
||||
try vx.prettyPrint(writer);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user