mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 15:19:13 +02:00
reword panics, label errors, config.ini tidbit
This commit is contained in:
parent
4b1f05b903
commit
d452fee5ef
3 changed files with 17 additions and 13 deletions
|
|
@ -401,6 +401,7 @@ posY = 1
|
|||
# See posX for [cmd:F8].
|
||||
posX = 0
|
||||
# Optional. Moves the label to the right of the terminal. Positive Axis now goes left.
|
||||
# If 0, only run once and do not refresh afterwards
|
||||
invertX = true
|
||||
# Optional. Moves the label to the bottom of the terminal. Positive Axis now goes up.
|
||||
invertY = true
|
||||
|
|
|
|||
|
|
@ -164,22 +164,22 @@ 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 keyZ = temporary_allocator.dupe(u8, key) catch @panic("FUCK");
|
||||
const keyZ = temporary_allocator.dupe(u8, key) catch |e|
|
||||
std.debug.panic("CustomCommands.binds: {} while duping key {s}", .{e, key});
|
||||
if (!CustomCommands.binds.contains(key)) {
|
||||
CustomCommands.binds.put(keyZ, .{}) catch |e| {
|
||||
std.log.err("CustomCommands.binds: {} while putting for key {s}", .{e, key});
|
||||
@panic("CustomCommands.binds failed");
|
||||
std.debug.panic("CustomCommands.binds: {} while putting for key {s}", .{e, key});
|
||||
};
|
||||
}
|
||||
if (CustomCommands.binds.getPtr(keyZ)) |command| {
|
||||
if (std.mem.eql(u8, field.key, "name")) {
|
||||
command.name = temporary_allocator.dupe(u8, field.value) catch {
|
||||
@panic("FUCK");
|
||||
command.name = temporary_allocator.dupe(u8, field.value) catch |e| {
|
||||
std.debug.panic("CustomCommands.binds: {} while duping name '{s}'", .{e, field.value});
|
||||
};
|
||||
}
|
||||
if (std.mem.eql(u8, field.key, "cmd")) {
|
||||
command.cmd = temporary_allocator.dupe(u8, field.value) catch {
|
||||
@panic("FUCK");
|
||||
command.cmd = temporary_allocator.dupe(u8, field.value) catch |e| {
|
||||
std.debug.panic("CustomCommands.binds: {} while duping command '{s}", .{e, field.value});
|
||||
};
|
||||
}
|
||||
if (std.mem.eql(u8, field.key, "posX")) {
|
||||
|
|
@ -193,19 +193,19 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
|||
|
||||
if (std.mem.startsWith(u8, field.header, "lbl:")) {
|
||||
const key = field.header[4..];
|
||||
const keyZ = temporary_allocator.dupe(u8, key) catch @panic("FUCK");
|
||||
const keyZ = temporary_allocator.dupe(u8, key) catch |e|
|
||||
std.debug.panic("CustomCommands.labels: {} while duping key {s}", .{e, key});
|
||||
if (!CustomCommands.labels.contains(keyZ)) {
|
||||
CustomCommands.labels.put(keyZ, .{
|
||||
.name = keyZ
|
||||
}) catch |e| {
|
||||
std.log.err("CustomCommands.labels: {} while putting for key {s}", .{e, key});
|
||||
@panic("CustomCommands.labels failed");
|
||||
std.debug.panic("CustomCommands.labels: {} while putting for key {s}", .{e, key});
|
||||
};
|
||||
}
|
||||
if (CustomCommands.labels.getPtr(keyZ)) |label| {
|
||||
if (std.mem.eql(u8, field.key, "cmd")) {
|
||||
label.cmd = temporary_allocator.dupe(u8, field.value) catch {
|
||||
@panic("FUCK");
|
||||
label.cmd = temporary_allocator.dupe(u8, field.value) catch |e| {
|
||||
std.debug.panic("CustomCommands.labels: {} while duping command '{s}'", .{e, field.value});
|
||||
};
|
||||
}
|
||||
if (std.mem.eql(u8, field.key, "posX")) {
|
||||
|
|
|
|||
|
|
@ -1746,9 +1746,12 @@ fn updateCustomInfo(lbl: *Label, ptr: *anyopaque) !void {
|
|||
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.appendSlice(state.allocator, "[Something went wrong!]");
|
||||
try stdout.print(state.allocator, "{s}: [Command didn't print anything!]", .{i.info.name});
|
||||
state.allocator.free(lbl.text);
|
||||
lbl.text = try state.allocator.dupe(u8, stdout.items);
|
||||
|
||||
// we reposition the widgets in the event of a inverted label.
|
||||
// not doing so causes the inverted label to not be positioned correctly
|
||||
try positionWidgets(state);
|
||||
if (i.info.refresh != 0)
|
||||
i.info.counter = i.info.refresh;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue