Prepare for Zig 0.17.0

Still requires Zig 0.16.x for now.

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2026-07-07 11:51:05 +02:00
parent 78c7c2e2e8
commit 5ccd91c132
7 changed files with 546 additions and 399 deletions

View File

@@ -578,9 +578,9 @@ fn parseKeybind(self: *TerminalBuffer, io: std.Io, keybind: []const u8) !keyboar
while (iterator.next()) |item| {
var found = false;
inline for (std.meta.fields(keyboard.Key)) |field| {
if (std.ascii.eqlIgnoreCase(field.name, item)) {
@field(key, field.name) = true;
inline for (comptime std.meta.fieldNames(keyboard.Key)) |name| {
if (std.ascii.eqlIgnoreCase(name, item)) {
@field(key, name) = true;
found = true;
break;
}

View File

@@ -113,14 +113,14 @@ pub const Key = packed struct {
pub fn getEnabledPrintableAscii(self: Key) ?u8 {
if (self.ctrl or self.alt) return null;
inline for (std.meta.fields(Key)) |field| {
if (field.name.len == 1 and std.ascii.isPrint(field.name[0]) and @field(self, field.name)) {
inline for (comptime std.meta.fieldNames(Key)) |name| {
if (name.len == 1 and std.ascii.isPrint(name[0]) and @field(self, name)) {
if (self.shift) {
if (!std.ascii.isAlphanumeric(field.name[0])) return null;
return std.ascii.toUpper(field.name[0]);
if (!std.ascii.isAlphanumeric(name[0])) return null;
return std.ascii.toUpper(name[0]);
}
return field.name[0];
return name[0];
}
}