Skip to content

Commit ae8ffc9

Browse files
committed
fix(api): More versatile keycode checking when restoring keymaps from resize mode
1 parent 3d9fa9e commit ae8ffc9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lua/smart-splits/resize-mode.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ local function wrap(fn)
1111
end
1212
end
1313

14+
local function compare_key(a, b)
15+
return vim.api.nvim_replace_termcodes(a, true, false, true) == vim.api.nvim_replace_termcodes(b, true, false, true)
16+
end
17+
1418
M.__map_cache = {}
1519
---Store any existing mappings to be restored after exit
1620
---@param resize_keys string[]
@@ -20,11 +24,11 @@ local function cache_mappings(resize_keys, quit_key)
2024
M.__map_cache = {}
2125
for _, map in ipairs(maps) do
2226
if
23-
map.lhs == resize_keys[1]
24-
or map.lhs == resize_keys[2]
25-
or map.lhs == resize_keys[3]
26-
or map.lhs == resize_keys[4]
27-
or map.lhs == quit_key
27+
compare_key(map.lhs, resize_keys[1])
28+
or compare_key(map.lhs, resize_keys[2])
29+
or compare_key(map.lhs, resize_keys[3])
30+
or compare_key(map.lhs, resize_keys[4])
31+
or compare_key(map.lhs, quit_key)
2832
then
2933
M.__map_cache[map.lhs] = map
3034
end

0 commit comments

Comments
 (0)