Skip to content

Commit 49c32c0

Browse files
committed
Revert "fix(#1676) case insensitive mapping key remove and override (#1682)"
This reverts commit 5a798b3.
1 parent 23c0fe9 commit 49c32c0

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

lua/nvim-tree/actions/init.lua

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -291,19 +291,15 @@ local function merge_mappings(user_mappings)
291291
for _, map in pairs(user_mappings) do
292292
if type(map.key) == "table" then
293293
for _, key in pairs(map.key) do
294-
if type(key) == "string" then
295-
table.insert(user_keys, key:lower())
296-
if is_empty(map.action) then
297-
table.insert(removed_keys, key:lower())
298-
end
294+
table.insert(user_keys, key)
295+
if is_empty(map.action) then
296+
table.insert(removed_keys, key)
299297
end
300298
end
301299
else
302-
if type(map.key) == "string" then
303-
table.insert(user_keys, map.key:lower())
304-
if is_empty(map.action) then
305-
table.insert(removed_keys, map.key:lower())
306-
end
300+
table.insert(user_keys, map.key)
301+
if is_empty(map.action) then
302+
table.insert(removed_keys, map.key)
307303
end
308304
end
309305

@@ -320,19 +316,14 @@ local function merge_mappings(user_mappings)
320316
if type(map.key) == "table" then
321317
local filtered_keys = {}
322318
for _, key in pairs(map.key) do
323-
if
324-
type(key) == "string"
325-
and not vim.tbl_contains(user_keys, key:lower())
326-
and not vim.tbl_contains(removed_keys, key:lower())
327-
then
319+
if not vim.tbl_contains(user_keys, key) and not vim.tbl_contains(removed_keys, key) then
328320
table.insert(filtered_keys, key)
329321
end
330322
end
331323
map.key = filtered_keys
332324
return not vim.tbl_isempty(map.key)
333325
else
334-
return type(map.key) ~= "string"
335-
or not vim.tbl_contains(user_keys, map.key:lower()) and not vim.tbl_contains(removed_keys, map.key:lower())
326+
return not vim.tbl_contains(user_keys, map.key) and not vim.tbl_contains(removed_keys, map.key)
336327
end
337328
end, M.mappings)
338329

@@ -375,17 +366,14 @@ local function filter_mappings(mappings, keys)
375366
if type(keys) == "boolean" and keys then
376367
return {}
377368
elseif type(keys) == "table" then
378-
local keys_lower = vim.tbl_map(function(k)
379-
return type(k) == "string" and k:lower() or nil
380-
end, keys)
381369
return vim.tbl_filter(function(m)
382370
if type(m.key) == "table" then
383371
m.key = vim.tbl_filter(function(k)
384-
return type(k) ~= "string" or not vim.tbl_contains(keys_lower, k:lower())
372+
return not vim.tbl_contains(keys, k)
385373
end, m.key)
386374
return #m.key > 0
387375
else
388-
return type(m.key) ~= "string" or not vim.tbl_contains(keys_lower, m.key:lower())
376+
return not vim.tbl_contains(keys, m.key)
389377
end
390378
end, vim.deepcopy(mappings))
391379
else

0 commit comments

Comments
 (0)