From 7be81e42a3b67ed7012373deec523905616767a6 Mon Sep 17 00:00:00 2001 From: sky03 Date: Mon, 11 Mar 2024 13:13:48 +0800 Subject: [PATCH] Update folder.lua --- yazi-plugin/preset/components/folder.lua | 29 ++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/yazi-plugin/preset/components/folder.lua b/yazi-plugin/preset/components/folder.lua index 914dd23c..9bc593a8 100644 --- a/yazi-plugin/preset/components/folder.lua +++ b/yazi-plugin/preset/components/folder.lua @@ -23,28 +23,33 @@ function Folder:linemode(area, files) spans[#spans + 1] = ui.Span(f.cha:permissions() or "") elseif mode == "mixin" then local size = f:size() + local content = "" - if f.cha.is_link then - if f.cha.is_socket then - spans[#spans + 1] = ui.Span("->sock") + + if f.cha.is_orphan then + content = "death link" + elseif f.cha.is_link then + if f.cha.is_dir then + content = "->" + elseif f.cha.is_socket then + content = "->sock" elseif f.cha.fifo then - spans[#spans + 1] = ui.Span("->fifo") + content = "->fifo" elseif f.cha.is_block_device or f.cha.is_char_device then - spans[#spans + 1] = ui.Span("->dev") + content = "->dev" else - spans[#spans + 1] = ui.Span("-> " .. (size and ya.readable_size(size)) or "") + content = "-> " .. (size and ya.readable_size(size) or "") end - elseif f.cha.is_orphan then - spans[#spans + 1] = ui.Span("death link") elseif f.cha.is_socket then - spans[#spans + 1] = ui.Span("sock") + content = "sock" elseif f.cha.is_fifo then - spans[#spans + 1] = ui.Span("fifo") + content = "fifo" elseif f.cha.is_block_device or f.cha.is_char_device then - spans[#spans + 1] = ui.Span("dev") + content = "dev" else - spans[#spans + 1] = ui.Span(size and ya.readable_size(size) or "") + content = size and ya.readable_size(size) or "" end + spans[#spans + 1] = ui.Span(content) end spans[#spans + 1] = ui.Span(" ")