mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-22 05:24:24 +02:00
migrator.zig: CustomCommands > custom + add unicode ID in comment
This commit is contained in:
parent
b704640a85
commit
c7b9d3f317
2 changed files with 8 additions and 8 deletions
|
|
@ -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 "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue