From 4f68dab62e77ce7f0b4bf2164634942dd6101312 Mon Sep 17 00:00:00 2001 From: Fasamii Date: Mon, 9 Feb 2026 00:24:48 +0100 Subject: parse_liststyle_3 early returns --- lua/netrw-icons/parse.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/netrw-icons/parse.lua b/lua/netrw-icons/parse.lua index fbd9da1..cd7ba79 100644 --- a/lua/netrw-icons/parse.lua +++ b/lua/netrw-icons/parse.lua @@ -79,38 +79,38 @@ end ---@param line string ---@return rwNode|nil local parse_liststyle_3 = function(line) - local current_dir = vim.b.netrw_curdir; - local type = M.TYPE_FILE; + local node = {}; + node.type = M.TYPE_FILE; local _, tree_end = string.find(line, "^[|%s]*"); + node.icon = tree_end; local content = string.sub(line, tree_end + 1, #line); if content == "" then return nil; end - local name = content; + node.name = content; - if name:sub(-1) == "*" then - type = M.TYPE_EXE; + if node.name:sub(-1) == "*" then + node.type = M.TYPE_EXE; + return node; end local _, _, link, link_target = string.find(content, "^(.+)@\t%s*%-%->%s*(.+)") if link then - type = M.TYPE_SYMLINK; - name = link_target; + node.type = M.TYPE_SYMLINK; + node.name = link_target; + return node; end local _, _, dir = string.find(content, "^(.*)/") if dir then type = M.TYPE_DIR; + return node; end - return { - name = name, - icon = tree_end, - type = type, - } + return node; end ---@param line string -- cgit v1.3