From 85c6d741d0aa27a4cc419b5af04e0f8b1bc881d5 Mon Sep 17 00:00:00 2001 From: Fasamii Date: Tue, 17 Feb 2026 23:04:45 +0100 Subject: FIX: buitlin type override by node type --- lua/netrw-icons/init.lua | 18 +++++++++--------- lua/netrw-icons/parse.lua | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lua/netrw-icons/init.lua b/lua/netrw-icons/init.lua index 8b4a575..81e6d2c 100644 --- a/lua/netrw-icons/init.lua +++ b/lua/netrw-icons/init.lua @@ -26,13 +26,13 @@ local function get_icon_provider(prefer) end if prefer and providers[prefer] then - return { type = prefer, provider = providers[prefer] } + return { provider_type = prefer, provider = providers[prefer] } end if providers.miniicons then - return { type = "miniicons", provider = providers.miniicons } + return { provider_type = "miniicons", provider = providers.miniicons } elseif providers.devicons then - return { type = "devicons", provider = providers.devicons } + return { provider_type = "devicons", provider = providers.devicons } end return nil @@ -41,13 +41,13 @@ end local function get_icon_from_provider(name) if icon_provider then local provider = icon_provider.provider; - local type = icon_provider.type; - if type == "devicons" then + local provider_type = icon_provider.provider_type; + if provider_type == "devicons" then local symbol, hi = provider.get_icon(name, nil, { strict = true, default = M.options.icon_fallback }); if symbol then return { symbol = symbol .. " ", hi = hi }; end - elseif type == "miniicons" then + elseif provider_type == "miniicons" then local symbol, hi, is_default = provider.get("file", name) if symbol then if is_default and not M.options.icon_fallback then @@ -79,11 +79,11 @@ local function get_icon_from_table(name, hi) end local function get_icon(node) - if node.type == parse.TYPE_DIR then + if node.node_type == parse.TYPE_DIR then return get_icon_from_table("dir", "netrwDir"); - elseif node.type == parse.TYPE_SYMLINK then + elseif node.node_type == parse.TYPE_SYMLINK then return get_icon_from_table("sym", "netrwSymlink"); - elseif node.type == parse.TYPE_EXE then + elseif node.node_type == parse.TYPE_EXE then return get_icon_from_table("exe", "netrwExe"); else if M.options.file then diff --git a/lua/netrw-icons/parse.lua b/lua/netrw-icons/parse.lua index 4b5d121..cea193f 100644 --- a/lua/netrw-icons/parse.lua +++ b/lua/netrw-icons/parse.lua @@ -19,26 +19,26 @@ M.TYPE_SYMLINK = 3 ---@return rwNode|nil local parse_liststyle_0 = function(line) local node = {}; - node.type = M.TYPE_FILE; + node.node_type = M.TYPE_FILE; node.icon = 0; node.name = line; if node.name:sub(-1) == "*" then - node.type = M.TYPE_EXE; + node.node_type = M.TYPE_EXE; return node; end local _, _, link, link_target = string.find(line, "^(.+)@\t%s*%-%->%s*(.+)") if link then - node.type = M.TYPE_SYMLINK; + node.node_type = M.TYPE_SYMLINK; node.name = link_target; return node; end local _, _, dir = string.find(line, "^(.*)/") if dir then - node.type = M.TYPE_DIR; + node.node_type = M.TYPE_DIR; return node; end @@ -49,26 +49,26 @@ end ---@return rwNode|nil local parse_liststyle_1 = function(line) local node = {}; - node.type = M.TYPE_FILE; + node.node_type = M.TYPE_FILE; node.icon = 0; node.name = line:match("^(%S+)") if node.name:sub(-1) == "*" then - node.type = M.TYPE_EXE; + node.node_type = M.TYPE_EXE; return node; end local _, _, link, link_target = string.find(line, "^(.+)@%s+") if link then - node.type = M.TYPE_SYMLINK; + node.node_type = M.TYPE_SYMLINK; node.name = link_target; return node; end local _, _, dir = string.find(line, "^(.*)/") if dir then - node.type = M.TYPE_DIR; + node.node_type = M.TYPE_DIR; return node; end @@ -79,7 +79,7 @@ end ---@return rwNode|nil local parse_liststyle_3 = function(line) local node = {}; - node.type = M.TYPE_FILE; + node.node_type = M.TYPE_FILE; local _, tree_end = string.find(line, "^[|%s]*"); node.icon = tree_end; @@ -92,20 +92,20 @@ local parse_liststyle_3 = function(line) node.name = content; if node.name:sub(-1) == "*" then - node.type = M.TYPE_EXE; + node.node_type = M.TYPE_EXE; return node; end local _, _, link, link_target = string.find(content, "^(.+)@\t%s*%-%->%s*(.+)") if link then - node.type = M.TYPE_SYMLINK; + node.node_type = M.TYPE_SYMLINK; node.name = link_target; return node; end local _, _, dir = string.find(content, "^(.*)/") if dir then - type = M.TYPE_DIR; + node.node_type = M.TYPE_DIR; return node; end -- cgit v1.3