From aa0d6ed0a4c22a773f5db25647004424fb946bf6 Mon Sep 17 00:00:00 2001 From: Fasamii Date: Mon, 9 Feb 2026 00:27:24 +0100 Subject: parse_liststyle_1 early returns --- lua/netrw-icons/parse.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/netrw-icons/parse.lua b/lua/netrw-icons/parse.lua index cd7ba79..d2692af 100644 --- a/lua/netrw-icons/parse.lua +++ b/lua/netrw-icons/parse.lua @@ -49,31 +49,31 @@ end ---@param line string ---@return rwNode|nil local parse_liststyle_1 = function(line) - local current_dir = vim.b.netrw_curdier; - local type = M.TYPE_FILE; + local node = {}; + node.type = M.TYPE_FILE; + node.icon = 0; - local name = line:match("^(%S+)") + node.name = line:match("^(%S+)") - 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(line, "^(.+)@%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(line, "^(.*)/") if dir then - type = M.TYPE_DIR; + node.type = M.TYPE_DIR; + return node; end - return { - name = name, - icon = 0, - type = type, - } + return node; end ---@param line string -- cgit v1.3