Review part 2

This commit is contained in:
RadsammyT 2026-03-18 08:34:09 -04:00
commit 6aa4a12fd2
No known key found for this signature in database
2 changed files with 11 additions and 10 deletions

View file

@ -164,7 +164,7 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
}
if (std.mem.startsWith(u8, field.header, "cmd:")) {
const key = field.header[4..];
const key = field.header["cmd:".len..];
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.binds.contains(key)) {
CustomCommands.binds.put(keyZ, .{}) catch {};
@ -177,16 +177,16 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
command.cmd = temporary_allocator.dupe(u8, field.value) catch "";
}
if (std.mem.eql(u8, field.key, "posX")) {
command.posX = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
command.posX = std.fmt.parseInt(u32, field.value, 10) catch 0;
}
if (std.mem.eql(u8, field.key, "posY")) {
command.posY = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
command.posY = std.fmt.parseInt(u32, field.value, 10) catch 0;
}
}
}
if (std.mem.startsWith(u8, field.header, "lbl:")) {
const key = field.header[4..];
const key = field.header["lbl:".len..];
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.labels.contains(keyZ)) {
CustomCommands.labels.put(keyZ, .{
@ -198,13 +198,13 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
label.cmd = temporary_allocator.dupe(u8, field.value) catch "";
}
if (std.mem.eql(u8, field.key, "posX")) {
label.posX = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
label.posX = std.fmt.parseInt(u32, field.value, 10) catch 0;
}
if (std.mem.eql(u8, field.key, "posY")) {
label.posY = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
label.posY = std.fmt.parseInt(u32, field.value, 10) catch 0;
}
if (std.mem.eql(u8, field.key, "refresh")) {
label.refresh = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
label.refresh = std.fmt.parseInt(u32, field.value, 10) catch 0;
label.refresh += 1;
}
if (std.mem.eql(u8, field.key, "invertX")) {

View file

@ -1795,13 +1795,14 @@ fn updateCustomInfo(lbl: *Label, ptr: *anyopaque) !void {
}
_ = try c.wait();
if (stdout.items.len != 0 and !std.ascii.isPrint(stdout.items[stdout.items.len-1]))
_ = stdout.pop()
else if (stdout.items.len == 0)
if (stdout.items.len != 0 and !std.ascii.isPrint(stdout.items[stdout.items.len-1])) {
_ = stdout.pop();
} else if (stdout.items.len == 0) {
try stdout.print(state.allocator, "{s}: [No output{s}]", .{
i.info.name,
if (stderr.items.len > 0) ": Possible Error" else ""
});
}
state.allocator.free(lbl.text);
lbl.text = try state.allocator.dupe(u8, stdout.items);