fix: correct match offsets when show_fileicons is off

This commit is contained in:
CJ van den Berg 2025-08-14 16:30:46 +02:00
parent c143eb6a59
commit 62b8493b93
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 7 additions and 6 deletions

View file

@ -95,7 +95,7 @@ pub fn Variant(comptime command: []const u8, comptime label_: []const u8, allow_
if (!(cbor.matchString(&iter, &icon_) catch false)) @panic("invalid file_type icon");
if (!(cbor.matchInt(u24, &iter, &color) catch false)) @panic("invalid file_type color");
tui.render_file_icon(&button.plane, icon_, color);
const icon_width = tui.render_file_icon(&button.plane, icon_, color);
button.plane.set_style(style_label);
_ = button.plane.print("{s} ", .{description_}) catch {};
@ -110,7 +110,7 @@ pub fn Variant(comptime command: []const u8, comptime label_: []const u8, allow_
var len = cbor.decodeArrayHeader(&iter) catch return false;
while (len > 0) : (len -= 1) {
if (cbor.matchValue(&iter, cbor.extract(&index)) catch break) {
tui.render_match_cell(&button.plane, 0, index + 4, theme) catch break;
tui.render_match_cell(&button.plane, 0, index + 2 + icon_width, theme) catch break;
} else break;
}
return false;