From a5b640c00ed9dbc626418f3a8d7353fe898577cc Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sat, 14 Feb 2026 16:19:25 +0100 Subject: [PATCH] fix: use tui.render_file_icon in file tree This fixes match cell rendering and de-duplicates a bit of code. --- src/tui/mode/overlay/project_file_tree_palette.zig | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/tui/mode/overlay/project_file_tree_palette.zig b/src/tui/mode/overlay/project_file_tree_palette.zig index c27b838..25cc726 100644 --- a/src/tui/mode/overlay/project_file_tree_palette.zig +++ b/src/tui/mode/overlay/project_file_tree_palette.zig @@ -231,17 +231,12 @@ pub fn on_render_menu(_: *Type, button: *Type.ButtonType, theme: *const Widget.T if (!(cbor.matchString(&iter, &file_icon) catch false)) return false; if (!(cbor.matchInt(u24, &iter, &icon_color) catch false)) return false; - if (icon_color == 0xFFFFFF or icon_color == 0x000000 or icon_color == 0x000001) - icon_color = style_label.fg.?.color; - - var icon_style = style_label; - icon_style.fg.?.color = icon_color; - button.plane.set_style(style_hint); tui.render_pointer(&button.plane, selected); - button.plane.set_style(icon_style); for (0..indent) |_| _ = button.plane.print(" ", .{}) catch {}; - _ = button.plane.print("{s} ", .{file_icon}) catch {}; + + const icon_width = tui.render_file_icon(&button.plane, file_icon, icon_color); + button.plane.set_style(style_label); _ = button.plane.print("{s} ", .{label_str}) catch {}; button.plane.set_style(style_hint); @@ -249,7 +244,7 @@ pub fn on_render_menu(_: *Type, button: *Type.ButtonType, theme: *const Widget.T 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 + 2, theme) catch break; + tui.render_match_cell(&button.plane, 0, index + 2 + icon_width + indent, theme) catch break; } else break; } return false;