refactor: simplify load_entries in command and theme palette

This commit is contained in:
CJ van den Berg 2024-08-19 22:53:38 +02:00
parent 67ffff4caa
commit e83d9ea74d
2 changed files with 3 additions and 10 deletions

View file

@ -22,11 +22,8 @@ pub const Match = struct {
var previous_theme: ?[]const u8 = null;
pub fn load_entries(palette: *Type) !void {
previous_theme = tui.current().theme.name;
for (Widget.themes) |theme| {
(palette.entries.addOne() catch @panic("oom")).* = .{
.name = theme.name,
};
}
for (Widget.themes) |theme|
(try palette.entries.addOne()).* = .{ .name = theme.name };
}
pub fn add_menu_entry(palette: *Type, entry: *Entry, matches: ?[]const usize) !void {