summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFasamii <fasami0512@gmail.com>2026-02-09 00:27:24 +0100
committerFasamii <fasami0512@gmail.com>2026-02-09 00:27:24 +0100
commitaa0d6ed0a4c22a773f5db25647004424fb946bf6 (patch)
treed2d9db188e0f0c2eb6010336a7fb36a5cc361caa
parent4f68dab62e77ce7f0b4bf2164634942dd6101312 (diff)
downloadnetrw-icons.nvim-aa0d6ed0a4c22a773f5db25647004424fb946bf6.tar.gz
netrw-icons.nvim-aa0d6ed0a4c22a773f5db25647004424fb946bf6.tar.bz2
netrw-icons.nvim-aa0d6ed0a4c22a773f5db25647004424fb946bf6.tar.xz
netrw-icons.nvim-aa0d6ed0a4c22a773f5db25647004424fb946bf6.tar.zst
parse_liststyle_1 early returns
-rw-r--r--lua/netrw-icons/parse.lua26
1 files 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