migrator.zig: CustomCommands > custom + add unicode ID in comment

This commit is contained in:
RadsammyT 2026-03-23 14:59:44 -04:00
commit c7b9d3f317
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View file

@ -16,7 +16,7 @@ const ini = ly_core.ini;
const Config = @import("Config.zig");
const OldSave = @import("OldSave.zig");
const SavedUsers = @import("SavedUsers.zig");
const CustomCommands = @import("custom.zig");
const custom = @import("custom.zig");
const color_properties = [_][]const u8{
"bg",
@ -166,10 +166,10 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
if (std.mem.startsWith(u8, field.header, "cmd:")) {
const key = field.header["cmd:".len..];
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.binds.contains(key)) {
CustomCommands.binds.put(keyZ, .{}) catch {};
if (!custom.binds.contains(key)) {
custom.binds.put(keyZ, .{}) catch {};
}
if (CustomCommands.binds.getPtr(keyZ)) |command| {
if (custom.binds.getPtr(keyZ)) |command| {
if (std.mem.eql(u8, field.key, "name")) {
command.name = temporary_allocator.dupe(u8, field.value) catch "";
}
@ -182,10 +182,10 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
if (std.mem.startsWith(u8, field.header, "lbl:")) {
const key = field.header["lbl:".len..];
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.labels.contains(keyZ)) {
CustomCommands.labels.put(keyZ, .{ .name = keyZ }) catch {};
if (!custom.labels.contains(keyZ)) {
custom.labels.put(keyZ, .{ .name = keyZ }) catch {};
}
if (CustomCommands.labels.getPtr(keyZ)) |label| {
if (custom.labels.getPtr(keyZ)) |label| {
if (std.mem.eql(u8, field.key, "cmd")) {
label.cmd = temporary_allocator.dupe(u8, field.value) catch "";
}

View file

@ -1769,7 +1769,7 @@ fn updateCustomInfo(lbl: *Label, ptr: *anyopaque) !void {
_ = try c.wait();
// Sometimes, the output of a command would have an unprintable character at
// the end of its output, causing '<27>' to appear in its place. Here, we check
// the end of its output, causing '<27>' (U+FFFD) to appear in its place. Here, we check
// if this is the case and remove it.
if (stdout.items.len != 0 and !std.ascii.isPrint(stdout.items[stdout.items.len - 1])) {
_ = stdout.pop();