Skip to content

Commit a3a3d81

Browse files
author
Bassam Data
committed
fix(selecta): fix C-c char special key
1 parent 3451272 commit a3a3d81

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

lua/namu/selecta/selecta.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ local SPECIAL_KEYS = {
14801480
ESC = vim.api.nvim_replace_termcodes("<ESC>", true, true, true),
14811481
BS = vim.api.nvim_replace_termcodes("<BS>", true, true, true),
14821482
MOUSE = vim.api.nvim_replace_termcodes("<LeftMouse>", true, true, true),
1483+
CTRL_C = vim.api.nvim_replace_termcodes("<C-c>", true, true, true),
14831484
}
14841485

14851486
---Delete last word from query
@@ -1807,15 +1808,11 @@ local function handle_char(state, char, opts)
18071808
handle_movement(state, 1, opts)
18081809
return nil
18091810
elseif vim.tbl_contains(movement_keys.close, char_key) then
1810-
-- For <C-c>, it's a special case. We need to check if the raw char value matches
1811-
-- Ctrl+C is usually 3 in ASCII
1812-
if char == 3 or vim.tbl_contains(movement_keys.close, char_key) then
1813-
if opts.on_cancel then
1814-
opts.on_cancel()
1815-
end
1816-
M.close_picker(state)
1817-
return nil
1811+
if opts.on_cancel then
1812+
opts.on_cancel()
18181813
end
1814+
M.close_picker(state)
1815+
return nil
18191816
elseif vim.tbl_contains(movement_keys.select, char_key) then
18201817
if opts.multiselect and opts.multiselect.enabled then
18211818
local selected_items = {}

0 commit comments

Comments
 (0)